Skip to content

Commit 958884b

Browse files
committed
Fix template-no-nested-landmark: drop port-only section/region
Upstream excludes <section> from LANDMARK_ELEMENTS and 'region' from LANDMARK_ROLES. Restore parity — port was over-flagging legitimate nested sections.
1 parent 56f913d commit 958884b

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

lib/rules/template-no-nested-landmark.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ const LANDMARK_ROLES = new Set([
55
'form',
66
'main',
77
'navigation',
8-
'region',
98
'search',
109
]);
1110

12-
const LANDMARK_ELEMENTS = new Set(['header', 'aside', 'footer', 'form', 'main', 'nav', 'section']);
11+
const LANDMARK_ELEMENTS = new Set(['header', 'aside', 'footer', 'form', 'main', 'nav']);
1312

1413
const EQUIVALENT_ROLE = {
1514
aside: 'complementary',

tests/lib/rules/template-no-nested-landmark.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ ruleTester.run('template-no-nested-landmark', rule, {
4242
'<template><div role="banner"><nav></nav></div></template>',
4343
'<template><header><div role="navigation"></div></header></template>',
4444
'<template><div role="banner"><div role="navigation"></div></div></template>',
45+
46+
// `<section>` is not a landmark element per upstream, so nested sections are allowed.
47+
'<template><section><section>Content</section></section></template>',
48+
// `role="region"` is not a landmark role per upstream, so nested regions are allowed.
49+
'<template><div role="region"><div role="region">Content</div></div></template>',
4550
],
4651

4752
invalid: [

0 commit comments

Comments
 (0)