Users of accessibility services, such as screen readers, rely on content labels to understand the meaning of elements in an interface.
In some cases, such as when information is conveyed graphically within an element, content labels can provide a text description of the meaning or action associated with the element.
If elements in a user interface don't provide content labels, it can be difficult for some users to understand the information presented to them or to perform actions in the interface.
Implementation
Design
When designing a user interface, think carefully about how graphically represented content should be labeled for users of accessibility services. Content labels should follow these principles:
- Be succinct and clearly describe the meaning or action associated with an element.
- Don't include an element's type or state in its content label.
- If the element is associated with an action, describe the action, not the graphical representation.
- Don't instruct the user how to specifically interact with the element.
To learn more, read Material Design Accessibility Writing Guidelines.
Testing
To manually verify that an app's user interface isn't missing content labels:
- Turn on TalkBack.
- Open the app.
- Use linear navigation gestures to move accessibility focus to each element on the screen.
- If TalkBack moves focus to some element, but doesn't speak a meaningful representation of that element, or speaks an "unlabeled" message, that element might be missing a content label.
Android's automated testing tools can detect missing content labels. Consider using Accessibility Scanner for Android for manual testing of your app on-device. For automated tests, turn on accessibility checking in Espresso and Robolectric.