Skip to content

useHeadingContent (HTML)

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

Enforce that heading elements (h1, h2, etc.) have content and that the content is accessible to screen readers.

Accessible means that it is not hidden using the aria-hidden attribute. All headings on a page should have content that is accessible to screen readers to convey meaningful structure and enable navigation for assistive technology users.

<h1></h1>
code-block.html:1:1 lint/a11y/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Provide screen reader accessible content when using heading elements.

> 1 │ <h1></h1>
^^^^^^^^^
2 │

All headings on a page should have content that is accessible to screen readers.

<h1 aria-hidden="true">invisible content</h1>
code-block.html:1:1 lint/a11y/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Provide screen reader accessible content when using heading elements.

> 1 │ <h1 aria-hidden="true">invisible content</h1>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │

All headings on a page should have content that is accessible to screen readers.

<h1><span aria-hidden="true">hidden</span></h1>
code-block.html:1:1 lint/a11y/useHeadingContent ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Provide screen reader accessible content when using heading elements.

> 1 │ <h1><span aria-hidden="true">hidden</span></h1>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │

All headings on a page should have content that is accessible to screen readers.

<h1>heading</h1>
<h1 aria-label="Screen reader content"></h1>
<h1><span aria-hidden="true">hidden</span> visible content</h1>