Skip to content

Update autocomplete-valid-value-73f2c2.md #1907

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

20 changes: 20 additions & 0 deletions _rules/autocomplete-valid-value-73f2c2.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ This rule applies to any [HTML][] `input`, `select` and `textarea` element with
- **toggle**: the `autocomplete` attribute consists of a single token that is an [ASCII case-insensitive][] match for the string `off` or the string `on`; or
- **disabled**: the element is a [disabled element]; or
- **fixed value**: the element is an `input` element with a `type` [attribute value][] of `hidden`, `button`, `submit` or `reset`; or
- **fixed value**: the element is an `input` element with a `type` [attribute value][] of `button`, `checkbox`, `file`, `image`, `radio`, `reset` or `submit`; or
- **hidden**: the element is not [visible][], and not [included in the accessibility tree][]; or
- **static**: the element is not part of [sequential focus navigation][] and has a [semantic role][] that is not a [widget role][].

Expand Down Expand Up @@ -66,6 +67,9 @@ Many browsers provide auto-filling suggestions even when the control's `type` [a

The auto-completing feature of the `autocomplete` attribute benefits many users, but it is not required to satisfy success Criterion [1.3.5 Identify Input Purpose][sc135]. Setting `autocomplete="off"` on the element's [form owner](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#form-owner) prevents the user agent from completing it, but it does not prevent the `autocomplete` [attribute value][] from being programmatically identifiable.

The intent of **fixed value** list item in Applicability section is to clearly define to which `input` element's `type` attribute [attribute value][] the `autocomplete` attribute applies.
On an `input` element with a `type` [attribute value][] of `hidden`, the autocomplete attribute wears the [autofill anchor mantle](https://html.spec.whatwg.org/#autofill-anchor-mantle), describing the meaning of the given value. In all other cases, it wears the [autofill expectation mantle](https://html.spec.whatwg.org/#autofill-expectation-mantle).

### Bibliography

- [Understanding Success Criterion 1.3.5: Identify Input Purpose](https://www.w3.org/WAI/WCAG21/Understanding/identify-input-purpose.html)
Expand Down Expand Up @@ -248,6 +252,22 @@ This `autocomplete` attribute is inapplicable because it has the `off` value.
<label>Friend's first name<input type="text" autocomplete="off"/></label>
```

#### Inapplicable Example 8

The `autocomplete` attribute does not apply to `input` type `submit` elements.

```html
<input type="submit" autocomplete="off"/>
```

#### Inapplicable Example 9

Even if the input explicitly specify the amount of the transactions and user agents could use transaction amount information to suggest for example a credit card that has sufficient balance, the element is not [visible][], and not [included in the accessibility tree][]

```html
<input type="hidden" autocomplete="transaction-amount" value="100.00">
```

[ascii whitespace]: https://infra.spec.whatwg.org/#ascii-whitespace 'HTML ASCII whitespace 2020/08/12'
[ascii case-insensitive]: https://infra.spec.whatwg.org/#ascii-case-insensitive 'definition of ASCII case-insensitive'
[attribute value]: #attribute-value 'Definition of Attribute Value'
Expand Down