heading-levels-match-aria
Warns when an h1–h6 element's HTML computed heading level differs from the accessibility-exposed heading level (aria-level of the heading role).
The heading level of an element is the number obtained by adding the element's heading offset to its native heading level and then capping the result at 9.
Cite: HTML Living Standard — Heading levels and offsets
Under the current HTML-AAM mapping for h1–h6, the implicit aria-level is still the tag-name rank, so headingoffset / headingreset can make the outline level and the AT-exposed level diverge. An explicit aria-level can diverge as well. HTML allows that split; this rule surfaces it as a warning so authors can decide.
❌ Examples of incorrect code for this rule
<section headingoffset="1">
<h1>Section</h1>
</section>
<h1 aria-level="3">Title</h1>
✅ Examples of correct code for this rule
<h2>Section</h2>
<div headingoffset="2">
<h1 headingreset>Title</h1>
</div>
Elements that are not HTML h1–h6 (for example <div role="heading" aria-level="2">) have no HTML computed heading level, so this rule does not compare them.
Interface
{
"heading-levels-match-aria": boolean
}
Warn when the HTML computed heading level and the accessibility heading level differ
Default Severity
warning