Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Header and Footer elements inside of role=main parent are incorrectly treated as landmarks #492

Open
carrythebanner opened this issue Aug 23, 2023 · 1 comment

Comments

@carrythebanner
Copy link

carrythebanner commented Aug 23, 2023

When a <header> or <footer> element appears inside of a <main> element (with implicit role=main), the extension (correctly) does not consider it a landmark.

When a <header> or <footer> element appears inside of a <div> element with explicit role=main, the extension incorectly consisders it a banner/contentinfo landmark.

According to ARIA in HTML, the <footer> element's implied semantics are:

If not a descendant of an article, aside, main, nav or section element, or an element with role=article, complementary, main, navigation or region then role=contentinfo

Otherwise, role=generic

(Similar language appears for the <header> element.)

With this test code:

<body>
  <div role="main">
    <header>Header element</header>
    <div role="banner">Banner role</div>

    <footer>Footer element</footer>
    <div role="contentinfo">Contentinfo role</div>
  </div>
</body>

… there should be 3 landmarks:

  • main (div with explicit role="main")
  • banner (div with explicit role="banner")
  • contentinfo (div with explicit role="contentinfo")

Additionally, even if I explicitly assign role=none to the <header> or <footer>, they are still identified as landmarks:

<body>
  <div role="main">
    <header role="none">Header element</header>
    <footer role="none">Footer element</footer>
  </div>
</body>
@geoffrey-eisenbarth
Copy link

Similar to this, I think the spec has been updated so that <aside> are also context dependent: https://w3c.github.io/html-aam/#el-aside

Looks like:

  1. If <aside> is scoped to <body> or <main>, then it gets complimentary role and it is a landmark.
  2. Otherwise, it's not a landmark unless aria-label or aria-labelledby is specified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants