Skip to content

useAriaPropsForRole (HTML)

biome.json
{
"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>
code-block.html:1:7 lint/a11y/useAriaPropsForRole ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✖ The element with the checkbox ARIA role does not have the required ARIA attributes.

> 1 │ <span role="checkbox"></span>
│ ^^^^^^^^^^^^^^^
2 │

ℹ Assistive technologies expect an element with this role to provide these attributes. Without them, screen reader users may not understand the element.

ℹ Add the missing ARIA attribute(s):

- aria-checked

<span role="heading"></span>
code-block.html:1:7 lint/a11y/useAriaPropsForRole ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✖ The element with the heading ARIA role does not have the required ARIA attributes.

> 1 │ <span role="heading"></span>
│ ^^^^^^^^^^^^^^
2 │

ℹ Assistive technologies expect an element with this role to provide these attributes. Without them, screen reader users may not understand the element.

ℹ Add the missing ARIA attribute(s):

- aria-level

<span role="checkbox" aria-checked="true"></span>
<span role="heading" aria-level="1"></span>