Search code examples
androidaccessibilitytalkback

Android accessibility for ImageView


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 ?


Solution

  • 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.