This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 7551 - People are using <section> incorrectly
Summary: People are using <section> incorrectly
Alias: None
Product: HTML WG
Classification: Unclassified
Component: pre-LC1 HTML5 spec (editor: Ian Hickson) (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
Keywords: NE
Depends on:
Reported: 2009-09-09 13:00 UTC by Simon Pieters
Modified: 2010-10-04 14:57 UTC (History)
6 users (show)

See Also:


Description Simon Pieters 2009-09-09 13:00:08 UTC
Time and time again, I see people who use <section> where it shouldn't be used. Almost in all cases, the outline would make sense if all <section> tags would be removed from the markup.

Clearly, this is a bug in the spec.

I see patterns where people wrap parts of the page in <section> without having headings for them, which creates untitled sections in the outline. Making <section> without a heading not affect the outline would fix this; dropping <section> would fix this; evang to use <div> instead might fix this to some extent. Making the spec not discourage use of <div> and give examples for when to use it might help.

I see patterns where people wrap the contents between the <header> and the <footer> (if footer is present) of an <article> in a <section>. Making <section> without a heading not affect the outline would *not* fix this because the article might have sub headings further down. Dropping <section> would fix this. Restricting the content models to somehow catch this case might fix this. Introducing a <content> element might help.
Comment 1 Lars Gunther 2009-09-10 10:52:39 UTC
Actually, I think there has been so much talk about the "evils" of div, that people use section when a div would be the better choice. I've seen quite a lot of comments that say "section basically is a more semantic div", which is partly true, but not the whole truth.

I think we need to convey this message: If in doubt whether section is the better choice than div, use div, since at least the damage done will be less. (I see an article forming: "Overuse of section considered harmful"... Argh!)

An analogy would be when we first learned that *em* is better than *i*, since it was semantic, and people started to use em, even though the text actually was not supposed to be emphasized.

If there was one pedagogic value to XHTML 2 in this regard, it was that it did away with h1-h6 in favor of the generic h-element. This approach made it clear to readers exactly how sections did work. Now, I am not arguing that we should go down the XHTML 2 route. I am only trying to explain some aspects that I think could be useful in fixing this bug, which is pedagogic in nature.

Would this be a good rule of thumb?

Each section SHOULD contain exactly one heading (except subtitles), preferably as the first child element of the section. If no heading can be applied in such a way, one SHOULD use another element than section.
Comment 2 Ian 'Hixie' Hickson 2009-09-18 21:54:44 UTC
Over the past week or two there's been a lot of work to try to address this by tweaking text in the spec, adding a boatload of examples, having evang articles, etc. We should probably see if that helps before making more changes.

If there are still problems in a few weeks, please feel free to reopen this bug, ideally with examples showing the confusion so that I can study it in detail.