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.

35 lines
1.5 KiB

  1. # role-supports-aria-props
  2. Enforce that elements with explicit or implicit roles defined contain only `aria-*` properties supported by that `role`. Many ARIA attributes (states and properties) can only be used on elements with particular roles. Some elements have implicit roles, such as `<a href="#" />`, which will resolve to `role="link"`.
  3. ## Rule details
  4. This rule takes no arguments.
  5. ### Succeed
  6. ```jsx
  7. <!-- Good: the radiogroup role does support the aria-required property -->
  8. <ul role="radiogroup" aria-required aria-labelledby="foo">
  9. <li tabIndex="-1" role="radio" aria-checked="false">Rainbow Trout</li>
  10. <li tabIndex="-1" role="radio" aria-checked="false">Brook Trout</li>
  11. <li tabIndex="0" role="radio" aria-checked="true">Lake Trout</li>
  12. </ul>
  13. ```
  14. ### Fail
  15. ```jsx
  16. <!-- Bad: the radio role does not support the aria-required property -->
  17. <ul role="radiogroup" aria-labelledby="foo">
  18. <li aria-required tabIndex="-1" role="radio" aria-checked="false">Rainbow Trout</li>
  19. <li aria-required tabIndex="-1" role="radio" aria-checked="false">Brook Trout</li>
  20. <li aria-required tabIndex="0" role="radio" aria-checked="true">Lake Trout</li>
  21. </ul>
  22. ```
  23. ## Accessibility guidelines
  24. - [WCAG 4.1.2](https://www.w3.org/WAI/WCAG21/Understanding/name-role-value)
  25. ### Resources
  26. - [ARIA Spec, States and Properties](https://www.w3.org/TR/wai-aria/#states_and_properties)
  27. - [Chrome Audit Rules, AX_ARIA_10](https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#ax_aria_10)