[whatwg] Form controls inside a label but not labelled by it
mattraymond at earthlink.net
Thu Feb 17 08:53:07 PST 2011
On 2/17/2011 10:23 AM, Boris Zbarsky wrote:
> On 2/17/11 8:37 AM, Matthew Raymond wrote:
>> <input type='radio' name='a'>
>> The label doesn't specify which control is the one it's labeling.
> But the spec does:
> If the for attribute is not specified, but the label element has a
> labelable form-associated element descendant, then the first such
> descendant in tree order is the label element's labeled control.
> Now the markup here is invalid per the spec (<label>'s content model
> says "no descendant labelable form-associated elements unless it is the
> element's labeled control"), but which control is labeled is quite
I just realized that this is irrelevant because of this part of the spec:
The label element's exact default presentation and behavior, in
particular what its activation behavior might be, if anything,
should match the platform's label behavior.
That means that if clicking a text area wouldn't normally /focus/ an
option button on a particular platform (which, I believe, is all of
them), it shouldn't focus the option button. That means the Mozilla
behavior is definitely invalid.
> We all agree it's crappy markup.
> People do this all the time.
Never said they didn't. I'm just pointing out that an author has no
reason to believe that a specific behavior will occur based on the
semantics of the markup.
More information about the whatwg