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

On Thu, 17 Feb 2011, Mounir Lamouri wrote:
> Mozilla has an old Gecko bug [1] lying around about form controls not 
> focusable when they are inside a label that is not labelling them: when 
> the user clicks the form control, because it's part of the label, the 
> activation behaviour is done on the labelled element. Thus, the form 
> control isn't focused. Recently, this bug appeared on GMail [2]: if you 
> try to set a signature with Firefox and the HTML5 parser enabled, you 
> will not be able to focus the textarea but you will focus the radio 
> button instead. You can see a minimized test case here: 
> http://software.hixie.ch/utilities/js/live-dom-viewer/saved/839
> 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?

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.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Friday, 3 June 2011 15:57:36 UTC