Dostępność

a11y/autocomplete-valid

An autocomplete attribute holds only tokens the HTML standard defines (email, given-name, new-password…).

poważnastatyczneWCAG 1.3.5 · AAfe-a11y-forms

Dlaczego

Browsers and assistive technology fill and label fields from the autocomplete value. An invented value (autocomplete="e-mail", "nope") is ignored, so people with motor or memory impairments must type everything again, and the field's purpose is not exposed.

Poprawka

Use a field name from the standard (name, given-name, family-name, email, tel, street-address, postal-code, country-name, bday, username, current-password, new-password, one-time-code, cc-number…), optionally preceded by section-*, shipping or billing, and for contact fields home, work or mobile. Use off only where autofill would be wrong, never to stop password managers.

Przykłady

<!-- bad -->
<input id="mail" type="email" autocomplete="e-mail">
<!-- good -->
<input id="mail" type="email" autocomplete="email">
<input id="ship-zip" autocomplete="shipping postal-code">

Źródła

Fakty

Identyfikator
a11y/autocomplete-valid
Waga
poważna
Sprawdzanie
statyczne sprawdzane w kodzie źródłowym przez audit
Dotyczy plików
html angular vue svelte astro jsx
WCAG 2.2
1.3.5, poziom AA
Ten sam problem w
axe-core autocomplete-valid
Uczy jej skill
fe-a11y-forms Accessible forms
Od wersji
0.1.0

Plik reguły na GitHubie

Przeczytaj w terminalu

npx github:dawidolko/frontend-skills explain a11y/autocomplete-valid