source: frontend/node_modules/eslint-plugin-jsx-a11y/docs/rules/no-autofocus.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.1 KB
Line 
1# jsx-a11y/no-autofocus
2
3💼 This rule is enabled in the following configs: ☑️ `recommended`, 🔒 `strict`.
4
5<!-- end auto-generated rule header -->
6
7Enforce that autoFocus prop is not used on elements. Autofocusing elements can cause usability issues for sighted and non-sighted users, alike.
8
9## Rule options
10
11This rule takes one optional object argument of type object:
12
13```json
14{
15 "rules": {
16 "jsx-a11y/no-autofocus": [ 2, {
17 "ignoreNonDOM": true
18 }],
19 }
20}
21```
22
23For the `ignoreNonDOM` option, this determines if developer created components are checked.
24
25### Succeed
26```jsx
27<div />
28```
29
30### Fail
31```jsx
32<div autoFocus />
33<div autoFocus="true" />
34<div autoFocus="false" />
35<div autoFocus={undefined} />
36```
37
38## Accessibility guidelines
39General best practice (reference resources)
40
41### Resources
42- [WHATWG HTML Standard, The autofocus attribute](https://html.spec.whatwg.org/multipage/interaction.html#attr-fe-autofocus)
43- [The accessibility of HTML 5 autofocus](https://www.brucelawson.co.uk/2009/the-accessibility-of-html-5-autofocus/)
Note: See TracBrowser for help on using the repository browser.