About this AccessLint rule
The autocomplete attribute tells browsers and assistive technologies what kind of data a form field expects. When this attribute contains invalid values, browsers cannot offer autofill suggestions, and assistive technologies cannot identify the purpose of the input. This rule checks that every autocomplete value on input, select, and textarea elements uses tokens defined in the HTML specification.
Who is affected and why
People with cognitive disabilities often have difficulty filling out forms. When autocomplete values are correct, assistive technologies can label fields with familiar icons, rearrange layouts, or pre-fill known data, all of which reduce cognitive load. People with motor impairments also benefit because autofill means fewer keystrokes and less precise interaction. And for anyone using a password manager or browser autofill, valid autocomplete values are what make those tools work.
Invalid values silently break all of this. The browser does not throw an error; it simply ignores the attribute. The user gets no autofill, no icon hints, and no personalization.
WCAG success criterion
This rule maps to WCAG 1.3.5 Identify Input Purpose (Level AA). That criterion requires that the purpose of each form field collecting user information can be programmatically determined. Using valid autocomplete tokens is the primary technique for meeting this requirement in HTML.
How valid values are structured
The autocomplete attribute accepts a space-separated list of tokens in a specific order:
- An optional token starting with
section-(e.g.,section-billing), used to group related fields. - An optional
shippingorbillingtoken. - An optional contact type:
home,work,mobile,fax, orpager. This token is only allowed when the next token isemail,impp,tel, or a token starting withtel-. - A required autofill field name such as
name,email,username,street-address,postal-code,cc-number,bday, etc. - An optional
webauthntoken.
The full list of valid autofill field names is in the HTML specification's autofill section.
When this rule does not apply
The rule does not flag the following cases:
- The
autocompletevalue isonoroff(these are toggle values, not autofill tokens). - The element is disabled.
- The
inputtype isbutton,checkbox,file,image,radio,reset, orsubmit(these have fixed values and do not collect user data). - The element is not visible and not in the accessibility tree.
- The element is not focusable and does not have a widget role.
How to fix it
- Check each
autocompletevalue against the list of valid tokens in the HTML specification. - Fix typos and remove invented values. For example,
autocomplete="mail"is not valid; useautocomplete="email". - Make sure tokens appear in the correct order. A contact type like
workmust come immediately beforeemail,tel,impp, or atel-*token. - Match the
autocompletevalue to theinputtype. For example,autocomplete="email"belongs on aninputwithtype="email"ortype="text", not ontype="number".
Examples
Incorrect: invalid autocomplete value
The value mail is not a recognized autofill token.
<label for="user-email">Email</label>
<input id="user-email" type="email" autocomplete="mail">
Incorrect: tokens in the wrong order
The contact type work must come before email, not after it.
<label for="work-email">Work email</label>
<input id="work-email" type="email" autocomplete="email work">
Correct: valid autocomplete value
<label for="user-email">Email</label>
<input id="user-email" type="email" autocomplete="email">
Correct: multiple tokens in the right order
<label for="work-email">Work email</label>
<input id="work-email" type="email" autocomplete="work email">
Correct: section grouping with billing
<label for="billing-zip">Billing ZIP code</label>
<input id="billing-zip" type="text" autocomplete="section-billing billing postal-code">
Correct: autocomplete turned off
Turning off autocomplete with the off token is valid and is not flagged by this rule.
<label for="otp">One-time passcode</label>
<input id="otp" type="text" autocomplete="off">
Detect accessibility issues automatically
Rocket Validator scans your site with complementary accessibility engines, helping teams find issues across every page.
Help us improve our guides
Was this guide helpful?
๐
Trusted by teams worldwide
Validate at scale.
Ship accessible websites, faster.
Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.
Scheduled Reports
API Access
Open Source Standards
$7
/ 7 days
Pro Trial
Full Pro access. Cancel anytime.
Start Pro Trial โ
Join teams across 40+ countries