1.3.5 - Identify input purpose
Benefits users with:
- language and memory related disabilities
- cerebral palsy, stroke, head injury, motor neuron disease or learning disability
- motor impairments
Intent
The intent of this success criterion is to ensure that the purpose of a form input collecting information about the user can be programmatically determined, so that user agents can extract and present this purpose to users using different modalities. The ability to programmatically declare the specific kind of data expected in a particular field makes filling out forms easier, especially for people with cognitive disabilities.
Appropriate visible labels and instruction can help users understand the purpose of form input fields, but users may benefit from having fields that collect specific types of information be rendered in an unambiguous, consistent, and possibly customized way for different modalities - either through defaults in their user agent, or through the aid of assistive technologies.
For some input fields, the type attribute already offers a way to broadly specify the intention of the input field, for example, input type="tel", input type="email", or input type="password". However, these are only very broad categories, describing the type of input, but not necessarily its purpose, especially as it relates to user-specific input fields. As an example, type="email" indicates that the field is for an e-mail address but does not clarify if the purpose is for entering the user's e-mail address or some other person's e-mail.
Ways to meet the criterion
The purpose of each input field collecting information about the user can be programmatically determined when:
- The input field serves a purpose identified in the Input Purposes for User Interface Components section.
- The content is implemented using technologies with support for identifying the expected meaning for form input data.
Examples
Personal contact form using autofill
Autofill function helps users fill in the form easily and quickly.
Form with autocomplete attribute.
It supports autofill function and generates user information stored in a browser when a user:
- click an input field (mouse user)
- focus an input field and press a space bar (keyboard user)
Form without autocomplete attribute.
Without autocomplete attribute, it does not generate user information stored in a browser when a user:
- click an input field (mouse user)
- focus an input field and press a space bar (keyboard user)
Success
HTML code for each form field:
- First name - autocomplete="given-name"
- Last name - autocomplete="family-name"
- Street - autocomplete="street-address"
- City - autocomplete="address-level2"
- Province - autocomplete="address-level1"
- Postal code - autocomplete="postal-code"
Autocomplete attributes with appropriate values are provided. It generates the browser-stored information into specific form fields.
For more information, visit Input Purposes for User Interface Components section.
Failure
HTML code for each form field:
- First name - autocomplete="email"
- Last name - autocomplete="last-name"
- Street - autocomplete
- The first name has an incorrect value of the autocomplete attribute. It should be a given-name.
- The last name has an incorrect value of the autocomplete attribute. It should be a family-name instead of a last-name.
- Under the address section, only the street address has an autocomplete attribute without value. In this case, it may generate all address information onto the street field.
- This is not an exact failure of this criterion but will cause input errors by generating information in incorrect fields if they are required fields.
Testing principles
For each form field which collects information about the user of the form:
- Check that the form field has an autocomplete attribute and value pair that does not match the purpose of the input.
- Check that the input purpose is not communicated programmatically through any other method.
If checks 1 and 2 are true, then the failure condition applies, and the content fails the success criterion.
Supported general and HTML techniques to meet the criterion: