SiteLint documentation and guidelines

Add autocomplete attribute to form controls to help users fill out forms more efficiently

Description

This rule flags form controls (input, select, textarea) that are missing the autocomplete attribute. It uses the element’s name and id attributes as hints to determine whether the field likely collects user-specific data. When a hint positively matches a known user-specific token (e.g. email, given-name, cc-number), the issue is reported as confirmed. When no reliable hint is available, the issue is reported for manual verification.

The rule does not flag:

  • input[type="search"] – autocomplete is implicitly off for search fields
  • input[type="range"] and input[type="color"] – these never collect user-identity data
  • Any form control with disabled attribute
  • Any form control that already has a non-empty autocomplete attribute

Disabilities impacted

  • Motor impairments: users with conditions such as tremors, paralysis, or limited dexterity find typing difficult or painful. Autocomplete allows browsers to pre-fill known values, dramatically reducing the amount of manual input required to complete a form.
  • Cognitive disabilities: users with memory difficulties, dyslexia, or cognitive load limitations benefit from autofill because it removes the need to recall and re-enter personal information such as addresses or phone numbers accurately.
  • Visual impairments: users relying on screen readers and switch access devices can complete forms faster when assistive technologies can programmatically identify field purpose and offer autofill suggestions.

Why it matters

The autocomplete attribute communicates the purpose of a form field to browsers and assistive technologies. Without it, browsers cannot reliably offer autofill suggestions, and assistive technologies cannot determine what kind of data the field expects. For users who struggle with typing or memory recall, autofill is not a convenience – it is often the only practical way to complete a form independently.

WCAG Success Criterion 1.3.5 (Identify Input Purpose) is a Level AA requirement. It mandates that fields collecting information about the user must programmatically expose their purpose using values defined in the WCAG Input Purposes list, which maps directly to valid autocomplete token values.

What to manually verify

When this rule flags a field as requiring manual verification (no reliable name or id hint was found), a human tester must determine:

  1. Does the field collect user-specific data? Examples include name, address, phone number, email, payment details, or date of birth. If yes, an appropriate autocomplete value must be added.
  2. Is the correct token used? Refer to the WHATWG autofill token list to select the most specific applicable value (e.g. given-name rather than just name where possible).
  3. Is autocomplete="off" justified? Suppressing autofill is only appropriate in specific cases such as OTP fields or fields containing sensitive transactional data that must not be cached. It should not be used as a default.

Coding problems and solutions

Common coding problems

  • Missing autocomplete entirely: the attribute is simply absent, so neither browsers nor assistive technologies can infer the field’s purpose.
  • Using autocomplete="off" unnecessarily: developers suppress autofill by default as a precaution, which actively harms users who depend on it.
  • Using autocomplete="on" on all fields: while better than nothing, on is a generic hint. Specific tokens such as email or street-address give browsers and assistive technologies much more precise information.
  • Mismatched token: using a token that does not match the field’s actual purpose (e.g. autocomplete="name" on a field collecting only a surname) confuses autofill and may cause browsers to populate the wrong value.

How to fix it

Add a specific autocomplete token matching the field’s purpose

Correct example – specific tokens
<label for="given-name">First name</label>
<input type="text" id="given-name" name="given-name" autocomplete="given-name">
<label for="email">Email address</label>
<input type="email" id="email" name="email" autocomplete="email">
<label for="tel">Phone number</label>
<input type="tel" id="tel" name="tel" autocomplete="tel">

Use section and contact type prefixes for multi-person or multi-address forms

When a form collects data for more than one person or address (e.g. billing and shipping), prefix tokens with section-* or a contact type (billing, shipping) to disambiguate fields for the browser.

Correct example – billing and shipping addresses
<input type="text"  name="billing-line1"  autocomplete="billing street-address">
<input type="text"  name="shipping-line1" autocomplete="shipping street-address">

Use autocomplete=”off” only when justified

Correct example – OTP field where caching is inappropriate
<label for="otp">One-time passcode</label>
<input type="text" id="otp" name="otp" autocomplete="one-time-code">
Incorrect example – autocomplete absent
<label for="email">Email address</label>
<input type="email" id="email" name="email">
<!-- Browser and assistive technologies cannot determine field purpose -->
Incorrect example – generic off suppresses autofill without justification
<label for="given-name">First name</label>
<input type="text" id="given-name" name="given-name" autocomplete="off">
<!-- Prevents assistive technologies from offering autofill to users who need it -->

Known limitations

  • Hint matching is heuristic: the rule infers field purpose from name and id values. A field named user-email-address will not match the email token because the token is not an exact segment of the hint. Renaming fields to use standard token values as segments (e.g. billing-email) improves both rule accuracy and browser autofill behaviour.
  • Custom field names cannot be fully resolved: fields with non-descriptive names such as field_1 or input-a will always produce a manual verification issue, as intent cannot be inferred programmatically.
  • Server-rendered or dynamically injected fields: fields added to the DOM after the audit runs will not be evaluated. Audits should be run against the fully rendered page state.

Resources

Rule

  • Audit: Accessibility
  • Standard: WCAG 2.1 / WCAG 2.2
  • Level: AA
  • Success Criteria: 1.3.5 Identify Input Purpose
  • ID: autocomplete-attribute-usage
  • Type: Automated with manual verification fallback