source: frontend/node_modules/eslint-plugin-jsx-a11y/docs/rules/role-supports-aria-props.md

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 2 weeks ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.6 KB
Line 
1# jsx-a11y/role-supports-aria-props
2
3💼 This rule is enabled in the following configs: ☑️ `recommended`, 🔒 `strict`.
4
5<!-- end auto-generated rule header -->
6
7Enforce 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"`.
8
9## Rule details
10
11This rule takes no arguments.
12
13### Succeed
14```jsx
15<!-- Good: the radiogroup role does support the aria-required property -->
16<ul role="radiogroup" aria-required aria-labelledby="foo">
17 <li tabIndex="-1" role="radio" aria-checked="false">Rainbow Trout</li>
18 <li tabIndex="-1" role="radio" aria-checked="false">Brook Trout</li>
19 <li tabIndex="0" role="radio" aria-checked="true">Lake Trout</li>
20</ul>
21```
22
23### Fail
24
25```jsx
26<!-- Bad: the radio role does not support the aria-required property -->
27<ul role="radiogroup" aria-labelledby="foo">
28 <li aria-required tabIndex="-1" role="radio" aria-checked="false">Rainbow Trout</li>
29 <li aria-required tabIndex="-1" role="radio" aria-checked="false">Brook Trout</li>
30 <li aria-required tabIndex="0" role="radio" aria-checked="true">Lake Trout</li>
31</ul>
32```
33
34## Accessibility guidelines
35- [WCAG 4.1.2](https://www.w3.org/WAI/WCAG21/Understanding/name-role-value)
36
37### Resources
38- [ARIA Spec, States and Properties](https://www.w3.org/TR/wai-aria/#states_and_properties)
39- [Chrome Audit Rules, AX_ARIA_10](https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules#ax_aria_10)
Note: See TracBrowser for help on using the repository browser.