Back to Info and Examples for Accessibility Insights for Web
autocomplete-valid
The autocomplete
attribute must be used correctly.
Why it matters
The HTML autocomplete
attribute communicates the purpose of a form field specifically, consistently, and unambiguously to browsers and assistive technologies.
Autocomplete, when used correctly, enables browsers to suggest a form field’s value based on previous user input. Autocomplete makes it faster and easier for everyone to fill out forms.
Browsers can’t accurately suggest the value of an input field with a missing or invalid autocomplete
attribute.
As a result, people will find it more burdensome to provide the expected input, especially people with cognitive disabilities.
How to fix
For form fields which require data specifically related to user information, provide a valid autocomplete
attribute value:
- Make sure you are using the correct attribute value. (For example,
"family-name"
is valid, while"last-name"
is not.) - Make sure the value is spelled correctly.
- Make sure the value is allowed for the field type.
Example
Fail
autocomplete
attribute value of "first-name"
.
Browsers can't suggest a value, so users have to enter the value manually.<label for="fname">First Name</label>
<input id="fname" type="text" autocomplete="first-name">
</div>
Pass
autocomplete
attribute value of "given-name"
.
Browsers can suggest a value for the field.<label for="fname">First Name</label>
<input id="fname" type="text" autocomplete="given-name">
</div>
About this rule
This rule passes if ALL of the following are true:
- The
autocomplete
attribute is correctly formatted - The
autocomplete
value is appropriate for the input type