Editable element accessibility label
Editable elements such as EditTexts or TextViews should have both name and value available to screen readers. This ensures editable elements are fully accessible, allowing their purpose (name) and current value to be accurately communicated to users relying on screen readers.
App Accessibility can automatically check for violations related to editable element accessibility labels. These tools ensure that all editable fields are appropriately labeled and can be read by screen readers, identifying any missing or incorrect labels.
- Rule Category :
Accessibility Labels
- WCAG 2.1 & 2.2 SC :
1.3.1 (A)
,4.1.2 (A)
- Rule Severity :
Critical
- Supported Platforms :
Android
,iOS
Success criteria
The rule checks for the following potential violations:
-
Missing Labels
Editable elements must have a descriptive label. -
Label-Value Association
The label should be associated with the corresponding editable element, ensuring screen readers convey both the label and the current value. -
Consistency
Labels should be consistent across different parts of the application.
How to fix
To ensure the accessibility label is defined for an editable element:
-
Provide a hint: Use the
hint
attribute forEditText
or editableTextView
elements to provide a label. Screen readers read this hint as the name of the field. -
Use
labelFor
: Associate aTextView
with anEditText
using thelabelFor
attribute to define a relationship between the label and the editable element.
To ensure the accessibility label is defined for an editable element:
-
Set the accessibility label: Use the
accessibilityLabel
property to provide a descriptive label forUITextField
orUITextView
elements.
Example
The following Android example scan report highlights the editable element with the ID com.bsstag.espressotesting:id/url
lacks an accessibility label. This violation prevents screen readers from providing the necessary information to users.
Fix
- Add a
hint
attribute to theEditText
element to provide a label. - Associate the
EditText
with aTextView
using thelabelFor
attribute to define a relationship between the label and the editable element.
References
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!