web 3d图形渲染器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
937 B

  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. ## Rule details
  4. This rule takes one optional object argument of type object:
  5. ```json
  6. {
  7. "rules": {
  8. "jsx-a11y/no-autofocus": [ 2, {
  9. "ignoreNonDOM": true
  10. }],
  11. }
  12. }
  13. ```
  14. For the `ignoreNonDOM` option, this determines if developer created components are checked.
  15. ### Succeed
  16. ```jsx
  17. <div />
  18. ```
  19. ### Fail
  20. ```jsx
  21. <div autoFocus />
  22. <div autoFocus="true" />
  23. <div autoFocus="false" />
  24. <div autoFocus={undefined} />
  25. ```
  26. ## Accessibility guidelines
  27. General best practice (reference resources)
  28. ### Resources
  29. - [WHATWG HTML Standard, The autofocus attribute](https://html.spec.whatwg.org/multipage/interaction.html#attr-fe-autofocus)
  30. - [The accessibility of HTML 5 autofocus](https://www.brucelawson.co.uk/2009/the-accessibility-of-html-5-autofocus/)