WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Hint for buttons on android

for

From: joe
Date: Apr 13, 2020 10:18AM


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