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.

преди 3 години
123456789101112131415161718192021222324252627282930313233343536373839
  1. # aria-role
  2. Elements with ARIA roles must use a valid, non-abstract ARIA role. A reference to role defintions can be found at [WAI-ARIA](https://www.w3.org/TR/wai-aria/#role_definitions) site.
  3. [AX_ARIA_01](https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#ax_aria_01)
  4. [DPUB-ARIA roles](https://www.w3.org/TR/dpub-aria-1.0/)
  5. ## Rule details
  6. This rule takes one optional object argument of type object:
  7. ```
  8. {
  9. "rules": {
  10. "jsx-a11y/aria-role": [ 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 role="button"></div> <!-- Good: "button" is a valid ARIA role -->
  20. <div role={role}></div> <!-- Good: role is a variable & cannot be determined until runtime. -->
  21. <div></div> <!-- Good: No ARIA role -->
  22. <Foo role={role}></Foo> <!-- Good: ignoreNonDOM is set to true -->
  23. ```
  24. ### Fail
  25. ```jsx
  26. <div role="datepicker"></div> <!-- Bad: "datepicker" is not an ARIA role -->
  27. <div role="range"></div> <!-- Bad: "range" is an _abstract_ ARIA role -->
  28. <div role=""></div> <!-- Bad: An empty ARIA role is not allowed -->
  29. <Foo role={role}></Foo> <!-- Bad: ignoreNonDOM is set to false or not set -->
  30. ```