diff --git a/doc/rule-descriptions.md b/doc/rule-descriptions.md index c2c4653255..a2f378329a 100644 --- a/doc/rule-descriptions.md +++ b/doc/rule-descriptions.md @@ -43,6 +43,7 @@ | label-title-only | Ensures that every form element is not solely labeled using the title or aria-describedby attributes | Serious | cat.forms, best-practice | true | | label | Ensures every form element has a label | Minor, Critical | cat.forms, wcag2a, wcag332, wcag131, section508, section508.22.n | true | | landmark-banner-is-top-level | Ensures the banner landmark is at top level | Moderate | cat.semantics, best-practice | true | +| landmark-complementary-is-top-level | Ensures the complementary landmark or aside is at top level | Moderate | cat.semantics, best-practice | true | | landmark-contentinfo-is-top-level | Ensures the contentinfo landmark is at top level | Moderate | cat.semantics, best-practice | true | | landmark-main-is-top-level | Ensures the main landmark is at top level | Moderate | cat.semantics, best-practice | true | | landmark-no-duplicate-banner | Ensures the document has at most one banner landmark | Moderate | cat.semantics, best-practice | true | diff --git a/lib/rules/landmark-complementary-is-top-level.json b/lib/rules/landmark-complementary-is-top-level.json new file mode 100644 index 0000000000..0df6dbb607 --- /dev/null +++ b/lib/rules/landmark-complementary-is-top-level.json @@ -0,0 +1,18 @@ +{ + "id": "landmark-complementary-is-top-level", + "selector": "aside:not([role]), [role=complementary]", + "matches": "landmark-has-body-context.js", + "tags": [ + "cat.semantics", + "best-practice" + ], + "metadata": { + "description": "Ensures the complementary landmark or aside is at top level", + "help": "Aside must not be contained in another landmark" + }, + "all": [], + "any": [ + "landmark-is-top-level" + ], + "none": [] +} diff --git a/lib/rules/landmark-has-body-context.js b/lib/rules/landmark-has-body-context.js index f5fd6bc0f2..4e399710e5 100644 --- a/lib/rules/landmark-has-body-context.js +++ b/lib/rules/landmark-has-body-context.js @@ -1,7 +1,7 @@ const nativeScopeFilter = 'article, aside, main, nav, section'; // Filter elements that, within certain contexts, don't map their role. -// e.g. a