[whatwg] Form controls inside a label but not labelled by it

On 06/04/2011 12:57 AM, Ian Hickson wrote:
> On Thu, 17 Feb 2011, Mounir Lamouri wrote:
>> According to a comment of Hixie in [1], this case has been handled by
>> the specs in 2004 but it doesn't seem to be any more and UA's have a
>> very different behaviour here:
>> - Firefox: focus and activate the labelled element ;
>> - Webkit: focus the form control and activate the labelled element ;
>> - Presto and IE9 RC: focus the form control (doesn't activate the
>> labelled element).
>>
>> I think Webkit's behaviour makes the more sense here and it would be
>> nice to have it specified.
>>
>> [1] https://bugzilla.mozilla.org/show_bug.cgi?id=213519
>> [2] https://bugzilla.mozilla.org/show_bug.cgi?id=595270
>
> Oops, not sure why the text was lost in the WF2 merge.
>
> I've added equivalent text back. It describes the Opera/IE behaviour;
> could you elaborate on why the WebKit behaviour is better?

Webkit behavior makes more sense because it tries to combine expected 
behavior for clicking inside a label and for clicking on an interactive 
element. It sounds much more natural.
Opera/IE behavior is similar to ignoring the fact that the interactive 
element is inside a label. Basically, Opera and IE are assuming that the 
author didn't want to write what he/she wrote. I do not think that is a 
sane behavior when they are good and real use cases for it.

> Authors can emulate the WebKit behaviour if they really want it by just
> calling .click() on the element they want to have activated when the
> target is focused.

Sure. Like the the Firefox one ;)

--
Mounir

Received on Friday, 10 June 2011 09:06:26 UTC