WebAIM - Web Accessibility In Mind

E-mail List Archives

Thread: Hint for buttons on android

for

Number of posts in this thread: 3 (In chronological order)

From: Ajay Sharma
Date: Fri, Apr 10 2020 3:46PM
Subject: Hint for buttons on android
No previous message | Next message →

Hello there,

I am seeking advice on adding hint text for buttons on android, I was exploring android:hint but turns out Talkback won't read it for buttons, though it reads hint text for edit fields.

So, is there any standard practice to achieve this?

Thanks!
Ajay

From: Mallory
Date: Mon, Apr 13 2020 7:37AM
Subject: Re: Hint for buttons on android
← Previous message | Next message →

My colleagues tell me there's no Android way of adding accessible descriptions to things like there is on iOS or the web. I'm assuming by "hint" you're not talking about the button names.
At my work we were discussing things like error messages which normally we'd associate with the inputs as an accessible description. For Android it seems we're relying on proximity for errors (the errors are either immediately before or immediately after the input), and for "help text" possibly stuffing that into the label (depending on how long it is. Too long and we don't). For buttons, I'd be interested if anyone on the list has a good technique!

cheers,
Mallory

On Fri, Apr 10, 2020, at 11:46 PM, Ajay Sharma wrote:
> Hello there,
>
> I am seeking advice on adding hint text for buttons on android, I was
> exploring android:hint but turns out Talkback won't read it for
> buttons, though it reads hint text for edit fields.
>
> So, is there any standard practice to achieve this?
>
> Thanks!
> Ajay
> > > > >

From: joe
Date: Mon, Apr 13 2020 10:18AM
Subject: Re: Hint for buttons on android
← Previous message | No next message

Hi All,

You can use android:hint attribute on a button to provide a description for that button separate from its accessible name (through android:text attribute to match the visible text label [preferred way to provide the accessible name] or through the android:contentDescription attribute to provide more than the visible text).

Now the android:hint is really intended for edit fields, it is valid on an Android <button>. It is different from the iOS accessibilityHint property in that on iOS VoiceOver users can disable accessibilityHints, whereas on Android, android:hints cannot be disabled by the user. This is probably because of their intended use.

I have actually tested this on one of my demo Android applications on a pixel 2 running android 10 with the latest version of TalkBack. A button with an android:hint is announced as "[Button text/contentDescription], Button, [Android:hint], [button state]". The android:hint attribute has been around since Android v.1 so it should be well supported on any device with the latest version of TalkBack/Google Accessibility Suite they can download.

If you would like to see a video I can post a link to a screen capture of my demo application.

Thankx,
Joe Humbert
Accessibility Champion
Android & iOS Accessibility Novice

References (very long technical developer resources):
https://developer.android.com/reference/android/widget/Button#inherited-xml-attributes
https://developer.android.com/reference/android/widget/TextView#inherited-xml-attributes