Skip to content

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

🛠️ 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.

Examples

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 using the config file or in the CLI, you can use:

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

References

Released under the MIT License.