Skip to content

`heading-level` does not handle `role="dialog"`

When using role="dialog" the heading-level rule incorrectly detects headings. The dialog element should be matched as a document with its own heading structure.

Reduced test-case

<h1>Heading 1</h1>
<h2>Heading 2</h2>

<h3>Item 1</h3>
<div role="dialog">
    <h1>Modal header</h1>
</div>

<h3>Item 2</h3>

Configuration

{
    "rules": {
        "heading-level": "error"
    }
}

Expected result

No error

Actual result

9:2 error Heading level can only increase by one, expected h2 heading-level

Version

  • html-validate-2.20.0