src/content/docs/linter/rules/use-aria-props-for-role.mdx
import { Tabs, TabItem } from '@astrojs/starlight/components';
<Tabs> <TabItem label="JSX and TSX" icon="seti:javascript"> ## Summary - Rule available since: `v1.0.0` - Diagnostic Category: [`lint/a11y/useAriaPropsForRole`](/reference/diagnostics#diagnostic-category) - This rule is **recommended**, meaning it is enabled by default. - This rule doesn't have a fix. - The default severity of this rule is [**error**](/reference/diagnostics#error). - Sources: - Same as [`jsx-a11y/role-has-required-aria-props`](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/role-has-required-aria-props.md){
"linter": {
"rules": {
"a11y": {
"useAriaPropsForRole": "error"
}
}
}
}
Enforce that elements with ARIA roles must have all required ARIA attributes for that role.
<span role="checkbox"></span>
<span role="heading"></span>
<span role="checkbox" aria-checked="true"></span>
<span role="heading" aria-level="1"></span>
{
"linter": {
"rules": {
"a11y": {
"useAriaPropsForRole": "error"
}
}
}
}
Enforce that elements with ARIA roles must have all required ARIA attributes for that role.
Remember that this rule only supports static values for the role attribute.
Dynamic role values are not checked.
<span role="checkbox"></span>
<span role="heading"></span>
<span role="checkbox" aria-checked="true"></span>
<span role="heading" aria-level="1"></span>