[whatwg] <figure><img><* caption>

Simon Pieters simonp at opera.com
Wed Dec 2 01:11:08 PST 2009

On Wed, 02 Dec 2009 03:58:32 +0100, Maciej Stachowiak <mjs at apple.com>  

> On Dec 1, 2009, at 4:08 PM, Tab Atkins Jr. wrote:
>> On Tue, Dec 1, 2009 at 6:01 PM, Hugh Guiney <hugh.guiney at gmail.com>  
>> wrote:
>>> Is there a reason we can't reuse <legend> (or <label>)? I don't think
>>> giving <p> an attribute that it can only use inside of <figure> is
>>> very straightforward.
>> Yes.  <legend> is documented as having rendering issues in all current
>> browsers if placed outside of a <fieldset> (for example, in some
>> browsers it will *generate a fieldset* around itself).  <label>
>> doesn't have appropriate keyboard accessibility when used for
>> <details>.
> It's not just rendering issues - all current browsers produce a broken  
> DOM when you include <legend> outside of <fieldset>, ranging from  
> dropping the <legend> element entirely to creating a fieldset to doing  
> the IE thing of adding void elements named "legend" and "/legend" (but  
> without the usual script workaround.
> I don't think keyboard accessibility is a problem for <label>. <details>  
> itself can be made focusable. I believe the only technical issues with  
> <label> are:
> 1) Some sites already have style rules for <label> based on the  
> assumption that it is only ever used for form labels. So they would have  
> to tweak their CSS to be able to use <details>. I don't think this  
> argument is very strong.
> 2) Using <label> could create issues in present-day browsers if the  
> label includes a form control. Specifically the label would be  
> considered the label of the form control if it has no other label, which  
> may not be appropriate. This is somewhat unlikely but not altogether  
> impossible.

3) If <label> were used for the caption, it would not be possible to use  
<label> as a form control label inside the figure caption (use case: "hot  
or not").

4) If <label> were used for the caption, it would not be possible to use  
<label> as the figure content (can't think of a compelling use case for  
this, but it's currently allowed).

> Opinions on the seriousness of these two issues vary, but I must concede  
> that the dt/dd solution does not have these two specific problems.
> BTW the current alternate proposal in the HTML Working Group is to  
> replace <dt>/<dd> with a <fltcap> element to use as the label for both  
> <figure> and <details>:  
> <http://esw.w3.org/topic/HTML/ChangeProposals/DdDt >.
> Regards,
> Maciej

Simon Pieters
Opera Software

More information about the whatwg mailing list