Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

3 lat temu
1234567891011121314151617181920212223242526272829303132333435
  1. # no-autofocus
  2. Enforce that autoFocus prop is not used on elements. Autofocusing elements can cause usability issues for sighted and non-sighted users, alike.
  3. #### References
  4. 1. [w3c](https://w3c.github.io/html/sec-forms.html#autofocusing-a-form-control-the-autofocus-attribute)
  5. ## Rule details
  6. This rule takes one optional object argument of type object:
  7. ```
  8. {
  9. "rules": {
  10. "jsx-a11y/no-autofocus": [ 2, {
  11. "ignoreNonDOM": true
  12. }],
  13. }
  14. }
  15. ```
  16. For the `ignoreNonDOM` option, this determines if developer created components are checked.
  17. ### Succeed
  18. ```jsx
  19. <div />
  20. ```
  21. ### Fail
  22. ```jsx
  23. <div autoFocus />
  24. <div autoFocus="true" />
  25. <div autoFocus="false" />
  26. <div autoFocus={undefined} />
  27. ```