コンテンツにスキップ

noAriaHiddenOnFocusable

このコンテンツはまだ日本語訳がありません。

Diagnostic Category: lint/a11y/noAriaHiddenOnFocusable

Since: v1.4.0

Sources:

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.

<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 │ <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”·/>
-------------------
<a href="/" aria-hidden="true" />
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·/>
-------------------
<button aria-hidden="true" tabIndex="-1" />
<button aria-hidden="true" tabIndex={-1} />
<div aria-hidden="true"><a href="#"></a></div>