Skip to content

useValidAriaRole (HTML)

biome.json
{
"linter": {
"rules": {
"a11y": {
"useValidAriaRole": "error"
}
}
}
}

Elements with ARIA roles must use a valid, non-abstract ARIA role.

Remember that this rule only supports static values for the role attribute. Dynamic role values are not checked.

<div role="datepicker"></div>
code-block.html:1:1 lint/a11y/useValidAriaRole  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✖ Enforce that elements with ARIA roles must use a valid, non-abstract ARIA role.

> 1 │ <div role="datepicker"></div>
│ ^^^^^^^^^^^^^^^^^^^^^^^
2 │

ℹ Check WAI-ARIA for valid roles or provide options accordingly.

ℹ Unsafe fix: Remove the invalid role attribute.
Check the list of all valid role attributes.

1 │ <div·role="datepicker"></div>
│ -----------------
<div role="range"></div>
code-block.html:1:1 lint/a11y/useValidAriaRole  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✖ Enforce that elements with ARIA roles must use a valid, non-abstract ARIA role.

> 1 │ <div role="range"></div>
│ ^^^^^^^^^^^^^^^^^^
2 │

ℹ Check WAI-ARIA for valid roles or provide options accordingly.

ℹ Unsafe fix: Remove the invalid role attribute.
Check the list of all valid role attributes.

1 │ <div·role="range"></div>
│ ------------
<div role=""></div>
code-block.html:1:1 lint/a11y/useValidAriaRole  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✖ Enforce that elements with ARIA roles must use a valid, non-abstract ARIA role.

> 1 │ <div role=""></div>
│ ^^^^^^^^^^^^^
2 │

ℹ Check WAI-ARIA for valid roles or provide options accordingly.

ℹ Unsafe fix: Remove the invalid role attribute.
Check the list of all valid role attributes.

1 │ <div·role=""></div>
│ -------
<div role="button"></div>
<div></div>

It allows specifying a list of roles that might be invalid otherwise

biome.json
{
"linter": {
"rules": {
"a11y": {
"useValidAriaRole": {
"level": "on",
"options": {
"allowInvalidRoles": [
"datepicker"
]
}
}
}
}
}
}
<div role="datepicker"></div>