SIA-R10autocomplete attributes have a valid value

Accessibility requirements

This rule tests conformance of the following accessibility requirements:

Description

This rule checks that autocomplete attributes have a valid value.

Applicability

This rule applies to every autocomplete attribute with a non-empty value, specified on an <input>, <select>, or <textarea> element in the HTML namespace, except when

The specification of the type attribute describes in detail how to map the value of the attribute to its corresponding state.

Expectations

  1. The value of the attribute is valid according to the specification of autocomplete attributes wearing the autofill expectation mantle. As such, the value must consist of either the case-insensitive string off or on, or a list of autofill detail tokens with an autofill field.

Assumptions

This rule makes no assumptions.

Accessibility support

This rule has the following accessibility support concern:

  • While the autocomplete attribute is a promising technique for supporting personalization on the web, support is limited.

  • Most browsers behave the same way whether the autocomplete attribute is appropriate for its control or not. Therefore, this rule doesn't check it.

Examples

Passed

These these elements have a valid autocomplete attribute and therefore pass the rule:

<input autocomplete="username" />
<textarea autocomplete="section-primary shipping work email"></textarea>
<select autocomplete="bday-month">
    <option>January</option>
    <option>...</option>
</select>

Failed

These elements have either an unknown autocomplete value, or the terms form an invalid combination, and therefore fail the rule:

<input autocomplete="badterm" />
<input autocomplete="work photo" />
<input autocomplete="work shipping email" />

Inapplicable

These elements are not visible and are therefore inapplicable:

<input autocomplete="username" style="display:none" />
<input type="hidden" autocomplete="username" />

These elements are disabled and are therefore inapplicable:

<input autocomplete="username" disabled />
<input autocomplete="username" aria-disabled="true" />

Acknowledgments

This document includes material copied from or derived from https://www.w3.org/WAI/standards-guidelines/act/rules/73f2c2/. Copyright © 2024 W3C® (MIT, ERCIM, Keio, Beihang).