For accessibility purpose each UI element should be described for visual disabled user who will navigate through the application using Google TalkBack. See Google documentation.
This description is provided by adding contentDescription attribute to the UI element.
contentDescription should be provided for each UI element.
Rule justification
Accessibility has become a major concern regarding mobile application development and it is part of WCAG requirements (WCAG 2.2).
Severity / Remediation Cost
Severity: Critical - regarding the accessibility category this flaw should be considered critical because users who need vocal assistance to navigate through the application will not be able to if this rule is not respected.
Remediation cost: Easy - add the contentDescription attribute. If the element should be not be considered by TalkBack the value can be set to null.
Implementation principle
In the xml view files check if contentDescription attribute is provided for each UI elements (no matter the value which can be null). Beware of the following exceptions:
Don't provide descriptions for TextView elements. Android accessibility services automatically announce the text itself as the description. (Google documentation)
Don't provide description if the element has the importantForAccessibility attribute to "no" (used for graphical elements that are only used for decorative effect).
Rule title
Accessibility: Provide
contentDescription
attribute for each UI elementLanguage and platform
XML - Android
Rule description
For accessibility purpose each UI element should be described for visual disabled user who will navigate through the application using Google TalkBack. See Google documentation. This description is provided by adding
contentDescription
attribute to the UI element.Bad code:
Good code:
Rule short description
contentDescription
should be provided for each UI element.Rule justification
Accessibility has become a major concern regarding mobile application development and it is part of WCAG requirements (WCAG 2.2).
Severity / Remediation Cost
Severity: Critical - regarding the accessibility category this flaw should be considered critical because users who need vocal assistance to navigate through the application will not be able to if this rule is not respected.
Remediation cost: Easy - add the
contentDescription
attribute. If the element should be not be considered by TalkBack the value can be set tonull
.Implementation principle
contentDescription
attribute is provided for each UI elements (no matter the value which can benull
). Beware of the following exceptions:TextView
elements. Android accessibility services automatically announce the text itself as the description. (Google documentation)importantForAccessibility
attribute to"no"
(used for graphical elements that are only used for decorative effect).