no-nested-top-level-landmark
Warns when a banner, main, or contentinfo landmark is nested inside another landmark, per APG's Landmark Regions practice: these roles should be top-level landmarks.
Split out of the former landmark-roles rule, alongside require-landmark-label.
APG also requires complementary to be top-level, but this rule deliberately does not check it: <aside>'s implicit role is conditional under ARIA 1.3 (nested inside certain sectioning ancestors it demotes to generic, not complementary), and this rule's selector-based detection has no way to tell the two apart — see the ARIA migration guide for the history of that decision.
❌ Examples of incorrect code for this rule
<!doctype html>
<html>
<body>
<header></header>
<main>
<main>Nested main landmark</main>
</main>
</body>
</html>
✅ Examples of correct code for this rule
<!doctype html>
<html>
<body>
<header></header>
<main>...</main>
<aside>...</aside>
</body>
</html>
ignoreRoles
Type: ("banner" | "main" | "complementary" | "contentinfo" | "form" | "navigation" | "region")[]
Default: []
Excludes the specified landmark roles from the check. Only banner, main, and contentinfo have any effect, since those are the only roles this rule checks.
Interface
{
"no-nested-top-level-landmark": boolean
}
Options
{
"no-nested-top-level-landmark": {
"options": {
"ignoreRoles"?: ("banner" | "main" | "complementary" | "contentinfo" | "form" | "navigation" | "region")[]
}
}
}
| Property | Type | Default Value | Description |
|---|---|---|---|
ignoreRoles | ("banner" | | "[]" | Excludes the specified landmark role from the warning. |
Default Severity
warning