Accessible input field labels
The accessible input field labels rule ensures that every input field has a visible and persistent label that can also be identified by assistive technologies. Field labels should accurately describe the purpose of the field and the expected input. Additionally, fields should not rely solely on placeholder text, as placeholders disappear when users input data, making it difficult for users to recall the required input.
Missing or inadequate labels severely impact usability and accessibility, especially for users with visual impairments or cognitive disabilities. Providing appropriate visible labels and instructions helps users understand the purpose of input fields.
- Rule Category :
Input Purpose
- WCAG 2.1 SC :
1.3.5 (AA)
,2.4.6 (AA)
,3.3.2 (A)
- WCAG 2.2 SC :
1.3.5 (AA)
,2.4.6 (AA)
,3.3.2 (A)
- Rule Severity :
Serious
- Supported Platforms :
Android
Success Criteria
The specific criteria for success are:
- Input fields must have a visible label that describes the purpose of the field and the type of data the user is expected to enter.
- Labels should remain visible even when the user interacts with the input field.
How to Fix?
- Ensure that every input field has a visible text label and a placeholder text that provides information about the expected input.
On Android, add the following attributes to the input field’sEditText
property:-
android:labelFor
- associate the input field with a label. -
android:text
- add a persistent label to the field. -
Optional:
android:hint
- provide placeholder text.
-
Example
Consider the following example:
Error:
- The input field element does not have an input label.
Fix
- Add the following attributes to the input field’s
EditText
property:-
android:labelFor
to associate an input label with the field. -
android:text
to describe the field and the expected data. -
Optional:
android:hint
to provide a hint or an example.
-
References
- Learn more about Identify Input Purpose: 2.1 - 1.3.5 (Level AA) guideline
- Learn more about Identify Input Purpose: 2.1 - 1.3.5 (Level AA) guideline
- Learn more about Headings and Labels: 2.1 - 2.4.6 (Level AA) guideline
- Learn more about Headings and Labels: 2.2 - 2.4.6 (Level AA) guideline
- Learn more about Labels or Instructions: 2.1 - 3.3.2 (Level A) guideline
- Learn more about Labels or Instructions: 2.2 - 3.3.2 (Level A) guideline
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!