whatwg / html

HTML Standard
https://html.spec.whatwg.org/multipage/
Other
8.09k stars 2.66k forks source link

Header/footer (inside sectioning content) inside header/footer? #5448

Open jovilog opened 4 years ago

jovilog commented 4 years ago

I always ignored the validator errors telling me:

The element header must not appear as a descendant of the footer element.

Because the content model of the footer element in HTML 5.2 makes perfect sense to me:

Flow content, but with no main element descendants, or header, footer elements that are not descendants of sectioning content which is a descendant of the footer.

Consulting the living standard this seems no longer true. Digging deeper I found these issues that seem to confirm (@stevefaulkner) that something like this should be allowed:

<footer>
    ...
    <section>
        <header>
            ...
        </header>
        ...
    </section>
    ...
</footer>

But, I couldn't find a corresponding issue here in the WHATWG repo or any hint when, where and why this change hade been reverted.

So, why are header/footer elements inside sectioning content inside a header/footer not allowed anymore? Thanks.

domenic commented 4 years ago

But, I couldn't find a corresponding issue here in the WHATWG repo or any hint when, where and why this change hade been reverted.

To be clear, that change was not reverted. Rather, when the W3C forked the HTML Living Standard, their fork included a variety of changes, and I'm guessing allowing footers inside headers is one of those.

I'd have to look at the linked issues in more detail to find the history as to why people think that footers should be allowed inside headers, so we can properly consider that for the HTML Standard. (Certainly it sounds very strange on the face of it, and from a quick skim most of the threads have people replying saying "this example doesn't make sense", but I guess eventually the fork editors came to the conclusion that there is a case for it.) Either way, I thought I'd at least clarify this misconception first.

jovilog commented 4 years ago

Thanks for the quick heads up. I don't know why that sounds strange though. The HTML Standard has this (3rd) example about "fat footers" where the footer content is partially structured with sectioning content.

When a section or other sectioning content can have a header/footer, I don't see why a section in a header/footer can't? When it has semantic meaning to group introductory content of a section inside a header, then why am I not allowed to do the same in a legit section inside a footer, and vice versa?

I don't know if it's ok to ping some of the participants of the linked issues?

Compare the following with example three of the footer element:

...
 <footer>
  <nav>
   <section>
    <header>
     <h1>Articles</h1>
     <p>Our latest ramblings.</p>
    </header>
    <p><img src="images/somersaults.jpeg" alt=""> Go to the gym with
    our somersaults class! Our teacher Jim takes you through the paces
    in this two-part article. <a href="articles/somersaults/1">Part
    1</a> · <a href="articles/somersaults/2">Part 2</a></p>
    <p><img src="images/kindplus.jpeg"> Tired of walking on the edge of
    a clif<!-- sic -->? Our guest writer Lara shows you how to bumble
    your way through the bars. <a href="articles/kindplus/1">Read
    more...</a></p>
    <p><img src="images/crisps.jpeg"> The chips are down, now all
    that's left is a potato. What can you do with it? <a
    href="articles/crisps/1">Read more...</a></p>
   </section>
   <ul>
    <li> <a href="/about">About us...</a>
    <li> <a href="/feedback">Send feedback!</a>
    <li> <a href="/sitemap">Sitemap</a>
   </ul>
  </nav>
  <p><small>Copyright © 2015 The Snacker —
  <a href="/tos">Terms of Service</a></small></p>
 </footer>
</body>

I understand and agree that a header/footer with a header/footer would be strange. But that is not applicable, because the footer element

represents a footer for its nearest ancestor sectioning content or sectioning root element

jovilog commented 3 years ago

Gently bumping this after a year... Anyone? @domenic, @stevefaulkner