Skip to content

jsx_a11y/role-has-required-aria-props Correctness ​

✅ This rule is turned on by default.

What it does ​

Enforces that elements with ARIA roles must have all required attributes for that role.

Why is this bad? ​

Certain ARIA roles require specific attributes to express necessary semantics for assistive technology.

Example ​

Examples of incorrect code for this rule:

jsx
<div role="checkbox" />

Examples of correct code for this rule:

jsx
<div role="checkbox" aria-checked="false" />

How to use ​

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

bash
oxlint --deny jsx-a11y/role-has-required-aria-props --jsx-a11y-plugin
json
{
  "plugins": ["jsx-a11y"],
  "rules": {
    "jsx-a11y/role-has-required-aria-props": "error"
  }
}

References ​

Released under the MIT License.