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?

3
  • 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. Commented Jun 29, 2014 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. Commented Jul 1, 2014 at 0: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. Commented Jul 1, 2014 at 1:42

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

4 Comments

I've been wrestling with a similar problem myself, and have discovered some related details which may prove useful to you. stackoverflow.com/questions/25001069/…
@grg-n-sox Did you resolve your problem? I'm interested to know the result. Also, have you seen Google Eyes-Free issue #375? I believe that this is related.
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.
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.