Skip to content
Permalink
9bfb9ba527
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time

jsx-a11y/autocomplete-valid

💼 This rule is enabled in the following configs: ☑️ recommended, 🔒 strict.

Ensure the autocomplete attribute is correct and suitable for the form field it is used with.

Rule options

This rule takes one optional object argument of type object:

{
    "rules": {
        "jsx-a11y/autocomplete-valid": [ 2, {
            "inputComponents": ["Input", "FormField"]
        }],
    }
}

Succeed

<!-- Good: the autocomplete attribute is used according to the HTML specification -->
<input type="text" autocomplete="name" />

<!-- Good: MyInput is not listed in inputComponents -->
<MyInput autocomplete="incorrect" />

Fail

<!-- Bad: the autocomplete attribute has an invalid value -->
<input type="text" autocomplete="incorrect" />

<!-- Bad: the autocomplete attribute is on an inappropriate input element -->
<input type="email" autocomplete="url" />

<!-- Bad: MyInput is listed in inputComponents -->
<MyInput autocomplete="incorrect" />

Accessibility guidelines

Resources