source: frontend/node_modules/eslint-plugin-jsx-a11y/docs/rules/autocomplete-valid.md

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.4 KB
Line 
1# jsx-a11y/autocomplete-valid
2
3💼 This rule is enabled in the following configs: ☑️ `recommended`, 🔒 `strict`.
4
5<!-- end auto-generated rule header -->
6
7Ensure the autocomplete attribute is correct and suitable for the form field it is used with.
8
9## Rule options
10
11This rule takes one optional object argument of type object:
12
13```
14{
15 "rules": {
16 "jsx-a11y/autocomplete-valid": [ 2, {
17 "inputComponents": ["Input", "FormField"]
18 }],
19 }
20}
21```
22
23### Succeed
24```jsx
25<!-- Good: the autocomplete attribute is used according to the HTML specification -->
26<input type="text" autocomplete="name" />
27
28<!-- Good: MyInput is not listed in inputComponents -->
29<MyInput autocomplete="incorrect" />
30```
31
32### Fail
33```jsx
34<!-- Bad: the autocomplete attribute has an invalid value -->
35<input type="text" autocomplete="incorrect" />
36
37<!-- Bad: the autocomplete attribute is on an inappropriate input element -->
38<input type="email" autocomplete="url" />
39
40<!-- Bad: MyInput is listed in inputComponents -->
41<MyInput autocomplete="incorrect" />
42```
43
44## Accessibility guidelines
45- [WCAG 1.3.5](https://www.w3.org/WAI/WCAG21/Understanding/identify-input-purpose)
46
47### Resources
48- [axe-core, autocomplete-valid](https://dequeuniversity.com/rules/axe/3.2/autocomplete-valid)
49- [HTML 5.2, Autocomplete requirements](https://www.w3.org/TR/html52/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute)
Note: See TracBrowser for help on using the repository browser.