Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/rules/template-no-nested-landmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ const LANDMARK_ROLES = new Set([
'form',
'main',
'navigation',
'region',
'search',
]);

const LANDMARK_ELEMENTS = new Set(['header', 'aside', 'footer', 'form', 'main', 'nav', 'section']);
const LANDMARK_ELEMENTS = new Set(['header', 'aside', 'footer', 'form', 'main', 'nav']);

const EQUIVALENT_ROLE = {
aside: 'complementary',
Expand Down
5 changes: 5 additions & 0 deletions tests/lib/rules/template-no-nested-landmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ ruleTester.run('template-no-nested-landmark', rule, {
'<template><div role="banner"><nav></nav></div></template>',
'<template><header><div role="navigation"></div></header></template>',
'<template><div role="banner"><div role="navigation"></div></div></template>',

// `<section>` is not a landmark element per upstream, so nested sections are allowed.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

upstream doesn't matter. what's MDN say?

Copy link
Copy Markdown
Contributor Author

@johanrd johanrd Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, changed the comment now — cites https://www.w3.org/WAI/ARIA/apg/patterns/landmarks/examples/HTML5.html directly: <section> only gets the region landmark role when it has an accessible name, otherwise it's generic.

'<template><section><section>Content</section></section></template>',
// `role="region"` is not a landmark role per upstream, so nested regions are allowed.
'<template><div role="region"><div role="region">Content</div></div></template>',
],

invalid: [
Expand Down
Loading