How to stop Accessibility from announcing android button as "button"?

akash89 picture akash89 · Nov 14, 2016 · Viewed 9.3k times · Source

I have a button in Android which has text "Next" written on it. when, I have the accsessibility cursor focus on the button, it reads out "Next button". This is something I don't want. I want whenever, the cursor to have focus on the "Next" button, it must read out as "Next button. Double tap to select". This I can easily do, by setting the btn.contentDescription("Next button. Double tap to select"), but then it reads out as "Next button. Double tap to select button", means it additionally reads out the last button, which seems very odd, with the "button" text getting read twice.

Is there any way, by which I can stop the last button to be announced?

Answer

ChrisCM picture ChrisCM · Nov 17, 2016

You're trying to do things that are the responsibility of the AT. The AT knows that the object is a button due to its class type. The AT knows that it is clickable, because Clickable is a valid accessibility action.

TalkBack will then share this information, here is the breakdown: "Next button, (pause) double tap to select"

"Next" -> Content Description/Text. This is the part you control.

"Button" -> Calculated in TalkBack based off of the valid actions and type(class) of the object.

"Double tap to select" -> This announcement is based off of Clickable being a valid accessibility action.

SO, when you set the contentdescription to "Next ....." you end up with an announcement of "next ....... button (pause) double tap to select" and no, there is no way to override this.

IF you are absolutely intent on making your app less accessible, you could create a custom control, write your own gesture recognizers (as in not using "onClick" events, because this would make your element accessibility clickable) to recognize tap gestures. And then write your own content description, that includes name, role, and instructions yourself.

This would be very silly in my opinion! Just let the content-description be "next" and let TalkBack tell users that your element is a button and how to interact with it. While perhaps not the "perfect" wording you/whoever this requirement came from's vision. It will be the way TalkBack users are accustomed to having this type of control announced. Consistency is sometimes more important than having things "just so".