Skip to content

noHeaderScope (HTML)

  • Rule available since: v2.3.0
  • Diagnostic Category: lint/a11y/noHeaderScope
  • This rule is recommended, meaning it is enabled by default.
  • This rule has an unsafe fix.
  • The default severity of this rule is error.
  • Sources:
biome.json
{
"linter": {
"rules": {
"a11y": {
"noHeaderScope": "error"
}
}
}
}

The scope prop should be used only on <th> elements.

<div scope="col"></div>
code-block.html:1:6 lint/a11y/noHeaderScope  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Avoid using the scope attribute on elements other than th elements.

> 1 │ <div scope="col"></div>
^^^^^^^^^^^
2 │

The scope attribute is used to associate a data cell with its corresponding header cell in a data table,
so it should be placed on th elements to provide accessibility to screen readers.

Follow the links for more information,
WCAG 1.3.1
WCAG 4.1.1

Unsafe fix: Remove the scope attribute.

1 │ <div·scope="col"></div>
-----------
<div scope></div>
code-block.html:1:6 lint/a11y/noHeaderScope  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Avoid using the scope attribute on elements other than th elements.

> 1 │ <div scope></div>
^^^^^
2 │

The scope attribute is used to associate a data cell with its corresponding header cell in a data table,
so it should be placed on th elements to provide accessibility to screen readers.

Follow the links for more information,
WCAG 1.3.1
WCAG 4.1.1

Unsafe fix: Remove the scope attribute.

1 │ <div·scope></div>
-----
<th scope="col"></th>
<th scope></th>