4

I have added contentDescription for some of the ImageView(s). When testing using TalkBack, some of them appends "button" to the contentDescription while some others do not. Doesn't there exist a consistent behavior for the speech ?

Note: Some of the ImageViews have OnClickListener while others have onTouchListener. The ImageView with onClickListener append "button" with the contentDescription while the ImageView with onTouchListener do not.

Also, I have noticed that setting android:clickable="true" for ImageView with onTouchListener announces "button" with the contentDescription.

What would be the best approach to handle this inconsistency ?
Does setting android:clickable="true" may anyhow affect the existing functionality with onTouchListener ?

r.bhardwaj
  • 1,603
  • 6
  • 28
  • 54
  • 1
    Is this imageViews is clickable? Do you set to them onClickListeners? Maybe that is a reason of "button" description. – VadymVL Mar 25 '15 at 08:11
  • post your code and xml here.. – Jignesh Jain Mar 25 '15 at 08:18
  • @VadymVL: Yes some of the ImageViews have OnClickListener while others have onTouchListeners. The one with onClickListeners append "button" with the contentDescription. Does adding **button** in the contentDescription for the ImageViews with onTouchListeners a recommended approach(to maintain consistency throughout the app) ? – r.bhardwaj Mar 25 '15 at 09:20
  • I have added **android:clickable="true"** for ImageView(s) and now it announces "button" with every ImageView. – r.bhardwaj Mar 25 '15 at 09:32
  • If you are using your imageViews as buttons, users with disabilities should know, that it can be used as button. So adding a "button" to description is required, so that users may interact with it. – VadymVL Mar 25 '15 at 09:42
  • Instead of adding "button" with contentDescription, setting the clickable property for ImageView has handled the announcement itself. – r.bhardwaj Mar 25 '15 at 09:56
  • @VadymVL Never put "button" in a content description. The accessibility service is responsible for generating role descriptions. – alanv Mar 25 '15 at 18:18
  • @alanv In my comment, by "adding a "button" to description is required" I tried to explain, why system is adding it. I don't mean you have to adding it manually. – VadymVL Mar 25 '15 at 18:44

1 Answers1

6

From an accessibility point of view a "button" is not a subtype of View, but rather an element that accepts interaction. Active images, images that accept touch events, clickables, onClickListeners, etc. are all examples of active images. These images announce as buttons, because if users double tap on the screen with them focused, they do things. If the image is simply informative, it will only read off it's content description. Equivalent to if they focused a paragraph of text.

TalkBack helps non-sighted users identify whether an image is an active or informative image, by adding a little information about the type of object they're interacting with. In this case type is defined by the types of interactions that can take place, not by the type of object it actually is.

MobA11y
  • 18,425
  • 3
  • 49
  • 76
  • "Active images, images that accept **touch events**, clickables, onClickListeners, etc. are all examples of active images." But I have noticed that the ImageView with onClickListeners append "button" with the contentDescription while the ImageView with **onTouchListener** do not. – r.bhardwaj Mar 26 '15 at 07:25
  • 2
    onTouchListener's shouldn't normally be used for "clicks". onTouchListeners are used for other, custom interactions. Using an onTouchListener to respond to simple button presses is possible, yes, but not the recommended use case, as this belongs in the onClickListener. This is why, items with onTouchListeners are not announced as buttons. In fact, IMHO, the simple inclusion of onTouchListeners inherently breaks accessibility of an app, unless alternate ways of performing those actions are provided. – MobA11y Mar 26 '15 at 13:16
  • any method available to get text of image view through accessibility APi? – Vishal Pandey Jun 12 '17 at 12:01
  • This sounds a lot like a different question... (AccessibilityNodeInfo.getContentDescription()) – MobA11y Jun 12 '17 at 14:04