Skip to main content
🚀 re:Imagine QA - See how AI reshapes your SDLC @ AWS re:Invent. Visit BrowserStack Booth!
No Result Found
Connect & Get help from fellow developers on our Discord community. Ask the CommunityAsk the Community

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 & 2.2 SC : 1.3.5 (AA)
  • Rule Severity : Moderate
  • Supported Platforms : Android, iOS

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 attribute to match the expected input described by the label. For example, use textPassword for a passphrase or password input.
  • On iOS, set the appropriate UITextContentType, such as .password or .newPassword. Additionally, ensure the input control, such as UITextField or SecureTextField, matches the expected input described by the label.

Examples

The following example scan report shows an input type violation in an Android app’s interface. The issue is identified for the Alternate Email input field.

Screenshot of a BrowserStack test report page showing an expanded view of an input type for input fields violation in an Android app.

Error

  • The inputType does not match the inputLabel. 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 is TYPE_CLASS_PHONE, which does not match the input label, Alternate Email.

Fix

  • Change the input type from TYPE_CLASS_PHONE to TYPE_TEXT_VARIATION_EMAIL_ADDRESS. This accurately conveys the expected input.

The following example scan report shows an input type violation in an iOS app’s interface. The issue is identified for the Passphrase input field.

Screenshot of a BrowserStack test report page showing an expanded view of an input type for input fields violation in an iOS app.

Error

  • The input type TextField does not align with the input label Enter your passphrase. Sensitive fields like passphrases should use a secure input type (e.g., UITextContentType.password) to ensure proper behavior for accessibility, security, and autofill.

Fix

  • Change the UITextContentType from TextField to .password or .newPassword to accurately reflect the expected secure input and improve accessibility.

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





Thank you for your valuable feedback

Is this page helping you?

Yes
No

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!

Talk to an Expert
Download Copy Check Circle