no-duplicate-h1
Warn if there is more than one h1 element in the document.
This rule is based on Techniques H42 for Success Criterion 1.3.1 in WCAG, Practices for skipping heading level and Web Accessibility Tutorials - Headings.
Split out of the former required-h1 rule, alongside require-h1.
❌ Examples of incorrect code for this rule
<html>
<body>
<h1>heading</h1>
<main>
<h1>another heading</h1>
</main>
</body>
</html>
✅ Examples of correct code for this rule
<html>
<body>
<h1>heading</h1>
<main>
<h2>subheading</h2>
</main>
</body>
</html>
Interface
{
"no-duplicate-h1": boolean
}
Options
{
"no-duplicate-h1": {
"options": {
"in-document-fragment"?: boolean
}
}
}
| Property | Type | Default Value | Description |
|---|---|---|---|
in-document-fragment | boolean | "false" | Set it to true if you want this rule to apply within document fragment rather than the entire document. |
Default Severity
warning