22

One of the latest updates for the Android SDK plugin in Eclipse introduced a lot of new warnings for your layouts and such. One of these is an accessibility warning that appears if you don't have the android:contentDescription tag set. This resulted in hundreds of warnings in one of my projects, and that naturally makes it a lot harder for me to find other more important warnings.

enter image description here

Looking at the official documentation, it seems that this tag is pretty useless from an end-user's perspective. Here's the description of it:

Defines text that briefly describes content of the view. This property is used primarily for accessibility. Since some views do not have textual representation this attribute can be used for providing such.

So basically, my question is what's the purpose of that tag? It only seems to be taking focus away from the "real" errors / warnings, and I don't really see how it can be an accessibility warning if it doesn't affect the user.

Michell Bak
  • 13,182
  • 11
  • 64
  • 121

1 Answers1

21

For some disabled people that tag almost similar to the "alt" tag in HTML, therefore it IS useful to the end user. Effectively it will allow a textual description to be presented to the user of what they may not be able to see clearly/interact with.

From the Android docs:

Defines text that briefly describes content of the view. This property is used primarily for accessibility. Since some views do not have textual representation this attribute can be used for providing such.

EDIT: Ice Cream Sandwich accessibility features are described in this article http://www.ubergizmo.com/2011/11/android-ice-cream-sandwich-accessibility/

There is a mention in this Google article as part of Android 4.0 highlights http://developer.android.com/sdk/android-4.0-highlights.html#UserFeatures

Graham Smith
  • 25,627
  • 10
  • 46
  • 69
  • 1
    When is it presented to these users? The warnings only appear on my ImageViews. – Michell Bak Feb 11 '12 at 17:29
  • 2
    Take a look at this http://www.ubergizmo.com/2011/11/android-ice-cream-sandwich-accessibility/ this explains in a bit of detail the ICS accessibility features. Why does it only appear on ImageViews? Well this is because they are images and Android doesn't have the ability (yet) to 'look' at the image and tell the user what it is of. – Graham Smith Feb 11 '12 at 17:33
  • Thanks, that's excellent! I knew it could do something like this, but I wasn't sure how it worked exactly. Looks like I'll have to go through several hundred ImageViews to support that kind of accessibility then. – Michell Bak Feb 11 '12 at 17:39
  • 2
    I have/do spend a lot of time on accessibility in general. I would be the first to say thanks for spending that time as touch devices offer a great opportunity to the visually impaired, and by you spending time on this you are only adding positive things to that experience. – Graham Smith Feb 11 '12 at 17:42
  • Hi, Exactly when does this gets used? I mean does this content description ever get presented to the user who is using the app. – Sreekanth Karumanaghat Mar 28 '19 at 09:24
  • @SreekanthKarumanaghat Well, I didnt test it but I believe when people activate features like the one where most of the screen gets read out by the device the underlying program might say the paragraph you specify in "contentDescription", since reading an image is kinda impossible. But thats just a guess. – Gereon99 Sep 19 '19 at 09:56