Invalid autocomplete value (autocomplete-valid)

The autocomplete-valid rule flags form fields whose autocomplete attribute holds a value the HTML standard does not define – firstname instead of given-name, phone instead of tel, or nope to switch autofill off. Browsers and assistive technology ignore a value they do not know. The fix is the correct token from the HTML autofill list.

What the rule means

WCAG 1.3.5 asks that a field collecting information about the user – name, email, phone, address, date of birth – says what it is for in a way software can read. On the web that is the autocomplete attribute with one of the purposes WCAG lists, which come from the HTML autofill field names. Then a browser can fill it in, and tools can show a familiar icon or wording beside it.

The rule reads every <input>, <select> and <textarea> that has a non-empty autocomplete attribute, and skips disabled and read-only fields, hidden inputs and buttons. A value passes when it is:

  • on or off,
  • one purpose token, such as given-name, email, postal-code or one-time-code,
  • optionally preceded by section-…, then shipping or billing, then – only before tel, email or impp – home, work, mobile, fax or pager, in that order.

axe also tolerates a few non-standard values that sites use to switch autofill off, such as none or false. A handful of values that are not in the standard – text, gender, pronouns, message, content – it does not decide; they come back for a person to review.

What the rule cannot see is whether a valid token is the right one. autocomplete="email" on the "Name" field passes. So does a field about the user with no autocomplete at all. Both are judgements, which is why the fact box above says "partly".

Who is affected

People with cognitive disabilities or memory difficulties, for whom typing an address again is a real barrier and autofill removes it. People with motor impairments, for whom every keystroke costs effort. People using tools that add familiar symbols to fields they recognise. And everybody filling in a checkout on a phone.

Why the check fails

  • Invented tokens that look plausible: firstname, lastname, phone, zip, mobile, birthday.
  • Random values to defeat autofill – autocomplete="nope" or "new-field" – copied from forum answers.
  • Tokens in the wrong order, such as billing section-1 postal-code, or two purposes in one value, such as name email.
  • A qualifier on the wrong token – work name or mobile postal-code; home, work and mobile belong only before tel, email or impp.
  • Form builders and shop plugins that write a field's internal name into autocomplete.

How to fix it

  1. For every field about the user, look up the purpose in the HTML autofill list [4] and use that token exactly.
  2. Combine only in the allowed order: section-…, then shipping/billing, then home/work/mobile, then the purpose.
  3. To switch autofill off on a field that is not about the user – a coupon code, a search box – use off, not an invented value.
<!-- Before: none of these tokens exist -->
<label for="first-name">First name</label>
<input id="first-name" name="fname" autocomplete="firstname">
<label for="phone">Mobile number</label>
<input id="phone" type="tel" name="phone" autocomplete="mobile phone">
<label for="email">Email</label>
<input id="email" type="email" name="email" autocomplete="nope">
<!-- After: valid tokens, in the allowed order -->
<label for="first-name">First name</label>
<input id="first-name" name="fname" autocomplete="given-name">
<label for="phone">Mobile number</label>
<input id="phone" type="tel" name="phone" autocomplete="mobile tel">
<label for="email">Email</label>
<input id="email" type="email" name="email" autocomplete="email">
<label for="ship-zip">Postcode</label>
<input id="ship-zip" name="ship-zip" autocomplete="shipping postal-code">

How to test it manually

  1. List the fields that ask for information about the person filling in the form – name, contact details, address, date of birth, username.
  2. In the developer tools, check each one has an autocomplete value, and that the value matches what the field asks for.
  3. Fill the form with your browser's saved address and payment details. Fields left empty, or filled with the wrong data, point to a missing or wrong token.
  4. Check split fields, such as first and last name or day, month and year: each needs its own token (given-name, family-name, bday-day, …).

1.3.5 Identify Input Purpose, Level AA. Related: 3.3.7 Redundant Entry, which asks that people are not made to type the same information twice in one process, and 3.3.2 Labels or Instructions – autocomplete helps software; the visible label is still what people read.

How Reviseberg reports it

Reviseberg runs autocomplete-valid on every crawled page at 1280px. The issue list shows the rule with its severity, WCAG criterion and level, the number of fields and pages affected, and the points you get back by fixing it. The detail view gives the CSS selector, the HTML snippet with the invalid value and every page affected – a checkout or newsletter form is usually one component, so one fix clears all of it.

Values axe does not decide go to the Potential issues queue for a person to review, instead of being counted as a pass. You can mark findings as "ignore", "can't fix" or "false positive" with a reason; every decision is logged. A clean result never marks 1.3.5 as passed: whether each field about the user has the right token is a person's check.

  • undefined – the same fields without a visible, connected label.
  • undefined – a country or title drop-down without a name.
  • undefined – custom fields built with ARIA roles that have no name.

Check the forms on your site – get a free scan

Frequently asked questions

Is autocomplete="off" a failure?

Not for this rule – off is a valid value. On a field that asks for information about the user, switching autofill off takes away the help 1.3.5 is about, so use it only where autofill would be wrong, such as a one-off code.

Does every field need autocomplete?

No. WCAG 1.3.5 covers fields that collect information about the user and whose purpose is in WCAG's list. A search box, a message or a coupon code need none.

What is section-… for?

It separates two groups of the same fields on one page – two delivery addresses, for example – so the browser does not fill both with the same data.

Why does axe accept none and false?

Because sites commonly use them to switch autofill off, and axe chooses not to flag them. They are still not standard HTML – off is, so use that.

Sources

  1. W3C, Understanding SC 1.3.5 Identify Input Purpose – https://www.w3.org/WAI/WCAG22/Understanding/identify-input-purpose
  2. Deque University, axe-core 4.13 rule autocomplete-valid – https://dequeuniversity.com/rules/axe/4.13/autocomplete-valid
  3. W3C, WCAG 2.2, section 7: Input Purposes for User Interface Components – https://www.w3.org/TR/WCAG22/#input-purposes
  4. WHATWG, HTML Standard: Autofill – https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill

See what a scan finds on your site

One page in about thirty seconds, no email needed. The full report covers up to 100 pages and a keyboard journey.