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

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.

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

Received on Tuesday, 1 December 2009 18:58:32 UTC