1

I am trying to get Talkback to read back a content descriptor on a button subclass. Once the button subclass is selected, Talkback gives me the content descriptor plus the word "button" at the very end. How do I prevent the extra word from being appended?

Note: I did some doc reading and noticed that dispathPopulateAccessibilityEvent() mentions getting an AccessibilityEvent populated/visiting children of the view that acted as the event trigger. Does this mean that the event always touches the view hierarchy?, and if so, is it the button superclass that is adding the text?

grg-n-sox
  • 717
  • 2
  • 5
  • 25
  • The accessibility service is adding this text. Are you sure you need to remove it? Users expect to hear this spoken and may be relying on it to understand the interaction model for that UI component. – alanv Jun 29 '14 at 23:09
  • I need to remove it because the content description went like, "Name_of_button button. Double-tap to action_button_causes." But then an extra "button" would be appended to that. I have, however, already found a solution and currently investigating a potentially better solution, so this should be answered soon. – grg-n-sox Jul 01 '14 at 00:26
  • In general you should make the content description as succinct as possible -- ideally, the same text that's visually displayed. Any interaction model information should be populated in the AccessibilityNodeInfo. If you add "double-tap" text you're giving users of switch access and Braille devices incorrect information. Additionally, you are hiding information (control type) that could be used by an accessibility service to provide better feedback. – alanv Jul 01 '14 at 01:42

1 Answers1

0

A simple workaround is to avoid using Button, which causes the extra words to be added.

For example, you may be able to replace it with a TextView, made to look like a button, and add a click listener using View.setOnClickListener(listener) to get the desired effect - see Android docs.

There are a number of such listeners in the basic View class which can be added to your UI component using View.setOn<Event>Listener(listener) in your Activity.onCreate method. In your case, a double-tap listener could be constructed with an onTouchListener, though it may require a little experimentation to get the precise result you want.

AwayTeam
  • 439
  • 5
  • 13
  • I've been wrestling with a similar problem myself, and have discovered some related details which may prove useful to you. http://stackoverflow.com/questions/25001069/android-how-to-eliminate-spoken-text-from-accessibilityevents-when-extending-se – AwayTeam Aug 05 '14 at 10:48
  • @grg-n-sox Did you resolve your problem? I'm interested to know the result. Also, have you seen [Google Eyes-Free issue #375](https://code.google.com/p/eyes-free/issues/detail?id=375)? I believe that this is related. – AwayTeam Sep 01 '14 at 14:56
  • Sorry for the delay. It did work, but because it is being treated as a TextView rather than a Button, frameworks that rely on knowling UI classes, such as the accessibility framework, might not behave as expected. In this case I didn't want to take on the risk so I changed my string to something else where having the word "Button" on the end makes sense. – grg-n-sox Jun 18 '15 at 22:47
  • 1
    You're welcome, and thanks for the feedback. Glad you solved your problem. The accessibility framework is a great idea, but hasn't yet matured sufficiently to allow the required flexibility. Let's hope it gets the attention it deserves in future. – AwayTeam Jun 20 '15 at 10:15