[whatwg] <hgroup> functionality absorbed into <header>?

Ian Hickson ian at hixie.ch
Fri Oct 9 01:18:01 PDT 2009


On Sat, 3 Oct 2009, Oli Studholme wrote:
> 
> In talking with authors about HTML5 <hgroup>[1] I’ve found it seems 
> confusing for many people, and I’ve also found it a little difficult to 
> explain so it’s easy to understand (conversation = why? outline 
> algorithm. huh?). Currently it’s only role is to hide subheadings from 
> the outline algorithm and it doesn’t map to a common use pattern for 
> adding semantic meaning. There doesn’t seem to be any tangible benefit 
> to authors in using it.

The tangible benefit is that when navigating the document by section, or 
when generating a table of contents, there will be the right number of 
sections.

For example, the W3C copy of HTML5 says:

   <h1>HTML5</h1>
   <h2>A vocabulary and associated APIs for HTML and XHTML</h2>
   <h2>Editor's Draft 9 October 2009</h2>
   ...
   <h2>Abstract</h2>
   ...

However, this is _not_ meant to mean:

   <section>
    <h1>HTML5</h1>
    <section>
     <h2>A vocabulary and associated APIs for HTML and XHTML</h2>
    </section>
    <section>
     <h2>Editor's Draft 9 October 2009</h2>
     ...
    </section>
    <section>
     <h2>Abstract</h2>
     ...
    </section>
    ...

...which is what it would be interpreted as. This is what is meant:

   <section>
    <h1>HTML5;
        A vocabulary and associated APIs for HTML and XHTML;
        Editor's Draft 9 October 2009</h1>
    ...
    <section>
     <h2>Abstract</h2>
     ...
    </section>
    ...

...and expressing that is only really possible with <hgroup> (or some 
similar feature, like an attribute toggle somewhere):

   <section>
    <hgroup>
     <h1>HTML5</h1>
     <h2>A vocabulary and associated APIs for HTML and XHTML</h2>
     <h2>Editor's Draft 9 October 2009</h2>
    </hgroup>
    ...
    <section>
     <h2>Abstract</h2>
     ...
    </section>
    ...


> Superfriends suggested a Boolean attribute for <header> to determine
> if all child <h1>-<h6> elements are included in the outline[2].

That would unfortunately prevent things like:

   <header>
    <h1>My great blog</h1>
    <h2>Navigation</h2>
    (navigation links...)
    <h2>About me</h2>
    (intro...)
   </header>


> The current <hgroup> model excludes all subtitles from the outline.

Well, UAs can show the text, it just prevents the subtitles from 
generating new sections in the outline.


> Assuming that subtitles should not be included in the outline (eg to 
> make sure the highest-ranked title is indeed descriptive), what if 
> <header> by default masked subtitles from the outline algorithm as 
> <hgroup> currently does?

In <header>, there are no subtitles, the titles would be actual titles for 
subsections. Previously, <hgroup> was just called <header> and did what 
you describe, but people indicated they wanted sections in <header>.


> Currently #the-header-element[3] mentions a “Little Green Guys With 
> Guns” example in which <h1>-<h6> elements in the <header> but outside 
> <hgroup> create implied <section> elements via the outline algorithm. If 
> <header> hides all but one <h1>-<h6> element this won’t happen (this is 
> also a potential issue with the Boolean attribute idea). While the spec 
> states authors should add wrapping <section>s I suspect many won’t 
> bother and rely on implied ones (unless they need CSS hooks). This would 
> also be potentially confusing compared with <footer>, and possibly 
> encourage authors to mistakenly add <section>s with <header>s inside of 
> a <header> (copy&paste mistakes etc).

Indeed.


> While this idea has drawbacks I feel <hgroup>’s lack of tangible
> author benefit and ‘occasional use’ nature will result in it not being
> widely used when it should be.

The most common uses will likely only take a few WordPress template 
changes for it to end up being used in a lot of places.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


More information about the whatwg mailing list