Skip to content

jsx_a11y/no-aria-hidden-on-focusable Correctness

This rule is turned on by default.
🛠️ An auto-fix is available for this rule.

What it does

Enforces that aria-hidden="true" is not set on focusable elements.

Why is this bad?

aria-hidden="true" on focusable elements can lead to confusion or unexpected behavior for screen reader users.

Example

Examples of incorrect code for this rule:

jsx
<div aria-hidden="true" tabIndex="0" />

Examples of correct code for this rule:

jsx
<div aria-hidden="true" />

How to use

To enable this rule in the CLI or using the config file, you can use:

bash
oxlint --deny jsx-a11y/no-aria-hidden-on-focusable --jsx-a11y-plugin
json
{
  "plugins": ["jsx-a11y"],
  "rules": {
    "jsx-a11y/no-aria-hidden-on-focusable": "error"
  }
}

References

Released under the MIT License.