useValidAutocomplete
Summary
Section titled “Summary”- Rule available since:
v1.9.0
- Diagnostic Category:
lint/a11y/useValidAutocomplete
- This rule is recommended, which means is enabled by default.
- This rule doesn’t have a fix.
- The default severity of this rule is error.
- Sources:
- Same as
jsx-a11y/autocomplete-valid
- Same as
Description
Section titled “Description”Use valid values for the autocomplete
attribute on input
elements.
The HTML autocomplete attribute only accepts specific predefined values.
This allows for more detailed purpose definitions compared to the type
attribute.
Using these predefined values, user agents and assistive technologies can present input purposes to users in different ways.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”<input type="text" autocomplete="incorrect" />
code-block.jsx:1:20 lint/a11y/useValidAutocomplete ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Use valid values for the autocomplete attribute.
> 1 │ <input type=“text” autocomplete=“incorrect” />
│ ^^^^^^^^^^^^^^^^^^^^^^^^
2 │
ℹ The autocomplete attribute only accepts a certain number of specific fixed values.
ℹ Follow the links for more information,
WCAG 1.3.5
HTML Living Standard autofill
HTML attribute: autocomplete - HTML: HyperText Markup Language | MDN
<> <input type="text" autocomplete="name" /> <MyInput autocomplete="incorrect" /></>
Options
Section titled “Options”{ "options": { "inputComponents": ["MyInput"] }}
Accessibility guidelines
Section titled “Accessibility guidelines”Resources
Section titled “Resources”How to configure
Section titled “How to configure”{ "linter": { "rules": { "a11y": { "useValidAutocomplete": "error" } } }}