[whatwg] <summary> and <details> elements' specification

Jukka K. Korpela jkorpela at cs.tut.fi
Mon Apr 11 22:14:59 PDT 2011


Aryeh Gregor wrote:

> On Mon, Apr 11, 2011 at 11:58 AM, Jukka K. Korpela
> <jkorpela at cs.tut.fi> wrote:
>> Not necessarily. The for="..." attribute could be made optional, so
>> that the default association is to associate the <summary> attribute
>> with the next sibling element.
>>
>> (I wonder why the association between <label> elements and input
>> fields has not been defined this way. It's too late now, but things
>> aren't too late for <details>.)
>
> If <label> has no "for" attribute, it labels its first labelable
> descendant.

Yes, as in HTML 4, but that's a different issue, related to descendants, not 
siblings. It requires that the input field be written inside a <label> 
element, which is illogical: the field is not part of its label.

Just as <label> could have been defined to be paired with (by default) its 
next sibling or, perhaps better, with the next input field, <summary> could 
be defined to be paired with its next sibling or, perhaps better, with the 
next <details> element, by default.

The element name "summary" is somewhat odd, and would appear even more odd 
if liberated from appearing inside <details>. This element is really meant 
to be a control for rendering vs. not rendering the contents of the 
<details> element, and its contents is just a label for the control. The 
example at
http://www.whatwg.org/specs/web-apps/current-work/multipage/interactive-elements.html#the-details-element
is accompanied with the note "In these examples, the summary really just 
summarises what the controls can change, and not the actual values, which is 
less than ideal." In reality, the example seems to correspond to _normal_ 
expected use of <details>, so the name "summary" is misleading. Perhaps 
<control> would be better, but as it's really a special kind of control 
only, how about <open>?

-- 
Yucca, http://www.cs.tut.fi/~jkorpela/ 




More information about the whatwg mailing list