hgroup: a possible alternative

Not sure if there's an open issue on hgroup that's accepting change
proposals, but here's the stub of an alternative idea for discussion
anyway.

It seems to me that much of the dislike of <hgroup> can be solved by
turning it inside out. Instead of:

 <hgroup>
  <h1>Medieval Beekeeping</h1>
  <h2>The evolution of an artform</h2>
 </hgroup>

You could have:

 <h1>
  <hline>Medieval Beekeeping</hline>
  <hline small>The evolution of an artform</hline>
 </h1>

<hline> would be a brand new element with an optional boolean attribute
"small". You'd normally style it something like this:

 hline { display:block; }
 hline[small] { font-size: smaller; }

The "small" attribute it not really presentational - it indicates a line
within the heading of lesser significance. If someone can think of a
better name for it, please do so.

Why <hline> and not <div> or <p>? Because allowing block elements within
a heading breaks the content model of headings going back pre-HTML-2.0
and would require incompatible changes to parsers.

Stephen Stewart recently posted a link to http://goo.gl/5wCVt - a very
interesting book chapter that deals with headlines from a newspaper
editors' perspective and contains several good examples of multi-part
headers, some of which seem like they could be better represented via
the <hline> construct (often by adding class attributes to hlines)
rather than <hgroup>. Here are some of the examples from that article
marked up using <hline>:

 <h1>
   <hline small class="kicker">Weird science</hline>
   <hline>High school inventions lean toward the wacky</hline>
 </h1>

 <h1>
   <hline class="hammer">Clinton <strong>Acquitted</strong></hline>
   <hline small>Perjury, obstruction charges defeated</hline>
 </h1>

 <h1>
   <hline>Olympic bid may be probed</hline>
   <hline small class="underline">Gift violation may reopen Atlanta case</hline>
 </h1>

 <h1>
   <hline small class="summary">Gov. Jesse Ventura blended
     his new job with an old one, filling in for a day as a
     talk-show host on KSTP Radio</hline>
   <hline>Broadcast muse</hline>
 </h1>

There is one possible problem with this approach: headings are
traditionally written without terminal punctuation unless the
punctuation is especially significant (e.g. an exclamation point or
question mark). Given that, older screen readers which would not be
aware of the semantics of <hline> could possibly run the lines of the
heading into each other as a single sentence. I'm not sure if a
display:block presentation has any effect on this. If someone could test
whether the following is run together as a single sentence in screen
readers, that might help...

 <div>
   <span style="display:block">Hello world</span>
   <span style="display:block">Hello world</span>
 </div>

-- 
Toby A Inkster
<mailto:mail@tobyinkster.co.uk>
<http://tobyinkster.co.uk>

Received on Monday, 10 January 2011 10:45:03 UTC