[whatwg] Question on (new) header and hgroup

jgraham at opera.com jgraham at opera.com
Thu May 7 13:34:46 PDT 2009


Quoting Smylers <Smylers at stripey.com>:

> 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.

The semantic that authors seem to want from an element named "header"  
is "All the top matter of my page before the main content". That could  
include headers, subheaders, navigation, asides (at least per the  
current definition of aside which I think is silly, but I digress) and  
almost anything else. Since the <header> can contain multiple distinct  
logical sections of the document, each with their own headers, it  
makes no sense to implicitly wrap its contents in <hgroup>.

> * 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.

Yes, that is possible. The thinking behind the change (or, at least,  
part of my reason for proposing it) was that it is less harmful if  
authors omit something where it would be useful than that they use it  
incorrectly in such a way that tools which follow the spec would be  
broken from the point of view of end users. In particular the old  
formulation of <header> would have caused the <h2> element to be  
omitted from the outline in cases like <header><h1>My  
Blog</h1><nav><h2>Navigation</h2></nav></header>, which would be  
confusing for users. On he other hand in the current formulation of  
the spec, the most likely error (omitting <hgroup>) only has the  
effect that that outline heirachy is slightly wrong, with the  
subheader appearing as an actual header; it does not lead to data  
loss. This seems like a much better failure mode.

> * 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?

It seems highly odd to have <header> perform a dual role where  
sometimes it means "section header" and sometimes it means "group of  
heading/subheading elements". Much more confusing than one element per  
role.





More information about the whatwg mailing list