autocomplete
Ensure the autocomplete attribute is correct and suitable for the form field.
✅ This rule is included in the jsx logical preset.
The autocomplete attribute helps browsers and assistive technologies automatically fill in form fields based on previously entered information.
Using correct autocomplete values improves accessibility and user experience by helping users complete forms more quickly and accurately.
The HTML specification defines a specific set of valid autocomplete tokens that must be used to ensure proper functionality.
Examples
Section titled “Examples”<input type="text" autocomplete="incorrect" /><input type="email" autocomplete="invalid" /><input type="text" autocomplete="name invalid" /><input type="text" autocomplete="name" /><input type="email" autocomplete="email" /><input type="password" autocomplete="current-password" /><input type="text" autocomplete="billing street-address" /><input type="text" autocomplete="off" />Options
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”If you’re working on a form that intentionally uses non-standard autocomplete values for specific browser or framework integrations, you may want to disable this rule. However, standard autocomplete values are recommended for better cross-browser compatibility and accessibility.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- ESLint:
jsx-a11y/autocomplete-valid - Oxlint:
jsx_a11y/autocomplete-valid