noAriaHiddenOnFocusable
Diagnostic Category: lint/a11y/noAriaHiddenOnFocusable
Since: v1.4.0
Sources:
- Same as:
jsx-a11y/no-aria-hidden-on-focusable
Enforce that aria-hidden=“true” is not set on focusable elements.
aria-hidden="true"
can be used to hide purely decorative content from screen reader users.
A focusable element with aria-hidden="true"
can be reached by keyboard.
This can lead to confusion or unexpected behavior for screen reader users.
Example
Section titled ExampleInvalid
Section titled Invalidcode-block.jsx:1:1 lint/a11y/noAriaHiddenOnFocusable FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Disallow aria-hidden=“true” from being set on focusable elements.
> 1 │ <div aria-hidden=“true” tabIndex=“0” />
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │
ℹ aria-hidden should not be set to true on focusable elements because this can lead to confusing behavior for screen reader users.
ℹ Unsafe fix: Remove the aria-hidden attribute from the element.
1 │ <div·aria-hidden=“true”·tabIndex=“0”·/>
│ -------------------
code-block.jsx:1:1 lint/a11y/noAriaHiddenOnFocusable FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Disallow aria-hidden=“true” from being set on focusable elements.
> 1 │ <a href=”/” aria-hidden=“true” />
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │
ℹ aria-hidden should not be set to true on focusable elements because this can lead to confusing behavior for screen reader users.
ℹ Unsafe fix: Remove the aria-hidden attribute from the element.
1 │ <a·href=”/“·aria-hidden=“true”·/>
│ -------------------
Valid
Section titled ValidResources
Section titled Resources- aria-hidden elements do not contain focusable elements
- Element with aria-hidden has no content in sequential focus navigation
- MDN aria-hidden