Input type for input fields
The input type for input fields rule ensures that each input field specifies the kind of information the user is expected to enter. Assigning accurate input types, such as email, phone number, or password, helps users quickly understand what they must enter in a particular field. Defining input types also supports assistive technologies in communicating the purpose of each field. Additionally, defining input types improves user experience by optimizing virtual keyboard usability and enhancing screen reader support.
- Rule Category :
Input Purpose
- WCAG 2.1 SC :
1.3.5 (AA)
- WCAG 2.2 SC :
1.3.5 (AA)
- Rule Severity :
Moderate
- Supported Platforms :
Android
Success Criteria
The specific criteria for success are:
- Input elements are focusable using a screen reader.
- Each input field is assigned an accurate input type.
How to Fix?
- On Android, set the
android:inputType
field for each input field based on the expected user input.
Example
The following example scan report shows an input type violation in the app’s interface. The issue is identified for the Alternate Email
input field.
Error:
- The
inputType
does not match theinputLabel
. Input types define the kind of information a user should enter in an input field. It should also match the input label accurately to avoid confusion. In this example, the input type isTYPE_CLASS_PHONE
, which does not match the input label,Alternate Email
.
How to fix:
- To fix the violation:
- Change the input type from
TYPE_CLASS_PHONE
toTYPE_TEXT_VARIATION_EMAIL_ADDRESS
. This accurately conveys the expected input.
- Change the input type from
References
- Learn more about Identify Input Purpose: 2.1 - 1.3.5 (Level AA) guideline
- Learn more about Identify Input Purpose: 2.2 - 1.3.5 (Level AA) 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!