[whatwg] Question on (new) header and hgroup

Smylers Smylers at stripey.com
Thu May 7 10:32:12 PDT 2009


James Graham writes:

> Bruce Lawson wrote:
> 
> > I'm struggling to understand the reasons for <hgroup>: wouldn't one
> > or more h1..h6 elements wrapped in the same <header> imply just such
> > a grouping without the need for such an element?
> 
> <hgroup> affects the document structure, <header> does not.

That explains _how_ they are different (as does the spec), but not _why_
it is like that.

More specifically:

* Are there significant cases where <header> needs _not_ to imply
  <hgroup>?  Consider wrapping an <hgroup> inside every <header>; how
  many places has that broken the semantics?  I could believe that most
  of the cases where a pager header appropriately contains multiple
  headings they are subtitles rather than subsections.

  Anybody who specifically needs subsections in a <header> could still
  have them by using <section> inside <header>.  That wouldn't help for
  the 'Little Green Guys with Guns' example (where a section is started
  in a <header> then 'leaks out' into the following elements) -- but
  would it be unacceptable to force authors to write that with </header>
  before one of the <h2>-s?

* Given the newness and nuance of <header> and <hgroup> and the
  distinction between them, it's likely that some authors will confuse
  them.  Given that <hgroup> doesn't appear to do anything on the page
  (it's similar to invisible meta-data), it's likely that some authors
  will omit it[*1] when it's needed to convey the semantics they intend.

  Might actually the number of authors who mistakenly write <header>
  instead of <header><hgroup> outnumber those who need to have
  subsections in headers?  That is, if <header> implied <hgroup>, might
  it fix more cases than it breaks?

* Are there significant cases where <hgroup> will be useful outside of
  <header>?

  <hgroup> exists to allow for subtitles and the like.  It's fairly
  common for documents to have these -- where it's likely there's use
  for a <header> element anyway.
  
  It's much less common for a mere section of a document to warrant a
  multi-part title; is that a case which is worth solving?  If it is,
  would it be problematic to force authors to use <header> there?

  I think that would mean that a subsection like this:

    <hgroup><h2>Kaboom!</h2> <h3>A Mysterious Loud Noise</h3></hgroup>
    <p>Suddenly ...

  Would instead have to be written as:

    <section>
      <header><h2>Kaboom!</h2> <h3>A Mysterious Loud Noise</h3></header>
      <p>Suddenly ...
    </section>

  That doesn't seem too onerous for such a niche usage.

If <header> implied <hgroup> semantics (but only acted as a heading if
there actually is an <h1> somewhere inside it) and if all current uses
of <hgroup> could be put inside a <header> then we could avoid
introducing the <hgroup> element.

Smylers

[*1]  <header> is less likely to suffer from this since it's often
replacing <div class="header"> or similar; authors want a block at that
point in the page anyway.



More information about the whatwg mailing list