Skip to content
← Back to rules

jsx-a11y/role-has-required-aria-props Correctness

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.

Examples ​

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

json
{
  "plugins": ["jsx-a11y"],
  "rules": {
    "jsx-a11y/role-has-required-aria-props": "error"
  }
}
ts
import { defineConfig } from "oxlint";

export default defineConfig({
  plugins: ["jsx-a11y"],
  rules: {
    "jsx-a11y/role-has-required-aria-props": "error",
  },
});
bash
oxlint --deny jsx-a11y/role-has-required-aria-props --jsx-a11y-plugin

Version ​

This rule was added in v0.2.0.

References ​