Skip to content

noRedundantRoles (HTML)

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

Enforce explicit role property is not the same as implicit/default role property on an element.

<article role="article"></article>
code-block.html:1:10 lint/a11y/noRedundantRoles  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Using the role attribute 'article' on the 'article' element is redundant, because it is implied by its semantics.

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

Unsafe fix: Remove the role attribute.

1 │ <article·role="article"></article>
--------------
<button role="button"></button>
code-block.html:1:9 lint/a11y/noRedundantRoles  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Using the role attribute 'button' on the 'button' element is redundant, because it is implied by its semantics.

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

Unsafe fix: Remove the role attribute.

1 │ <button·role="button"></button>
-------------
<h1 role="heading" aria-level="1">title</h1>
code-block.html:1:5 lint/a11y/noRedundantRoles  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Using the role attribute 'heading' on the 'h1' element is redundant, because it is implied by its semantics.

> 1 │ <h1 role="heading" aria-level="1">title</h1>
^^^^^^^^^^^^^^
2 │

Unsafe fix: Remove the role attribute.

1 │ <h1·role="heading"·aria-level="1">title</h1>
---------------
<article role="presentation"></article>
<span></span>