W3C home > Mailing lists > Public > whatwg@whatwg.org > January 2012

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

From: Ian Hickson <ian@hixie.ch>
Date: Tue, 10 Jan 2012 22:24:13 +0000 (UTC)
Message-ID: <Pine.LNX.4.64.1201102219560.14154@ps20323.dreamhostps.com>
On Fri, 10 Jun 2011, Mounir Lamouri wrote:
> 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.

Well, the _spec_ assumes that the author didn't want to write what they 
wrote. That's why it's non-conforming!

I don't think it makes sense to try to activate two things at once. The 
author clearly didn't express what they meant to express, but it seems 
highly unlikely that the author meant to express that the control in 
question should not be focusable at all.

I would guess that this error occurs typically due to copy pasta:

   <label for=a> <input id=a> </label>
   <label for=a> <input id=b> </label>
   <label for=a> <input id=c> </label>

Why would you want inputs "b" and "c" to be unfocusable via the mouse?

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Tuesday, 10 January 2012 14:24:13 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:39 UTC