[whatwg] Allow Headings As Children of <summary>

On Wed, 27 Oct 2010, Hugh Guiney wrote:
>
> I am authoring a video portfolio page using Kroc Camen's Video For 
> Everybody code <http://camendesign.com/code/video_for_everybody> for 
> each piece. In this code he includes a download section for users who 
> may be unable to play the video live on the site, e.g. because they lack 
> both HTML5 (or the proper browser codecs) and Flash support. As this 
> hopefully won't be a problem for most users, I would prefer not to 
> distract them with this information unless they decide they need it, and 
> therefore have chosen to mark it up with <details>.
> 
> However, I feel this "Download" portion is also important enough to be 
> its own subsection, as it is distinct from the surrounding content and 
> may be useful to navigate to as part of the document outline. The 
> obvious way to accomplish this would be for instance:
> 
> <details>
> <summary><h1>Download</h1></summary>
> <ul>
> <li><a href="video.mp4">MP4</a></li>
> <li><a href="video.ogg">OGG</a></li>
> ...
> </ul>
> </details>
> 
> but this is invalid via the current spec which only allows <summary> to 
> contain phrasing content. I could give it its own heading outside of 
> <details>, but this would be redundant as I would have to do duplicate 
> the heading text in both <h1> and <summary>, and it makes the expansion 
> action area ambiguous. A mouse user might encounter the collapsed menu 
> and not know whether to click on the heading or the summary to expand 
> it?or even just consider it the author's error, or a glitch.
> 
> Even if I were to use different text for each element, I find few things 
> to be appropriate in this context that are not similarly redundant. 
> "Download" for the heading and "Video Format Options" for the summary? 
> The fact that the list is of format options would be reasonably apparent 
> by the link text for each item indicating "MP4", "OGG", etc.
> 
> My proposal to address this would be to allow heading content under 
> <summary>?or, conversely, to allow <summary> to be used as a descendant 
> of <details> rather than just the first child, such that you could wrap 
> headings around it, as phrasing content is already allowed under 
> <details>. But, the latter changes structure and therefore parsing 
> whereas the former is simply a validation change.

I would recommend just doing:

   <details>
    <summary>Download</summary>
    <ul>
     ...
    </ul>
   </details>

...and not worrying about the Download bit ending up in the document 
outline. In practice, if the <details> in question is close to the <video> 
element, it would be pretty straight forward for users to find the 
download links without having to look for a "downloads" section in the 
document outline.

Putting an <h1> inside a <summary> wouldn't acutally put the <details> 
into the document's outline, because <details> elements are sectioning 
roots, which means they don't contribute to the document outline.

The reason we don't allow elements like <h1> in the summary is that the 
summary is intended to be a single line in the rendering, and so allowing 
elements that are intentionally separate "blocks" sends the wrong message. 
It would also be rather weird to have what is intended to be a disclosure 
widget be its own "section" in the document outline.

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

Received on Thursday, 6 January 2011 14:09:38 UTC