source: frontend/node_modules/eslint-plugin-jsx-a11y/docs/rules/no-aria-hidden-on-focusable.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.5 KB
RevLine 
[9af201e]1# jsx-a11y/no-aria-hidden-on-focusable
2
3<!-- end auto-generated rule header -->
4
5Enforce that `aria-hidden="true"` is not set on focusable elements.
6
7`aria-hidden="true"` can be used to hide purely decorative content from screen reader users. An element with `aria-hidden="true"` that can also be reached by keyboard can lead to confusion or unexpected behavior for screen reader users. Avoid using `aria-hidden="true"` on focusable elements.
8
9## Rule details
10
11### Succeed
12```jsx
13 <div aria-hidden="true" />
14 <img aria-hidden="true" />
15 <a aria-hidden="false" href="#" />
16 <button aria-hidden="true" tabIndex="-1" /> // `tabIndex=-1` removes the element from sequential focus navigation so we don't flag it.
17 <a href="/" />
18 <div aria-hidden="true"><a href="#"></a></div> // This is also bad but will not be handled by this rule.
19```
20
21### Fail
22```jsx
23 <div aria-hidden="true" tabIndex="0" />
24 <input aria-hidden="true" />
25 <a href="/" aria-hidden="true" />
26 <button aria-hidden="true" />
27 <textarea aria-hidden="true" />
28```
29
30## Accessibility guidelines
31General best practice (reference resources)
32
33### Resources
34
35- [aria-hidden elements do not contain focusable elements](https://dequeuniversity.com/rules/axe/html/4.4/aria-hidden-focus)
36- [Element with aria-hidden has no content in sequential focus navigation](https://www.w3.org/WAI/standards-guidelines/act/rules/6cfa84/proposed/)
37- [MDN aria-hidden](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-hidden)
Note: See TracBrowser for help on using the repository browser.