[whatwg] LABEL and radio/checkbox onclick

Matthew Thomas mpt at myrealbox.com
Wed Jul 21 02:08:34 PDT 2004


On 21 Jul, 2004, at 1:58 AM, Mikko Rantalainen wrote:
> ...
> So, the *real* problem is that UA sends form on pseudo-random basis[1] 
> if user presses ENTER

No, that was just an example. Another example would be accidentally 
demolishing a complicated discontiguous selection in a <select 
multiple> by pressing an arrow key, when all you really wanted to do 
was scroll the page.

> and to fix this, you think that label should be forbidden for other 
> controls but checkbox and radio button?

No, I did not say <label> should be forbidden for controls other than 
checkboxes and radiobuttons. I said that clicking on such a label 
should not focus the control on platforms where doing so is not native 
behavior (i.e. all of them).

> How about fixing the ENTER key issue, instead?

No, because in that detail UAs are already following native behavior of 
the Enter key.

> I agree that having ENTER to submit the form is a great feature in 
> some cases -- for example, when I use Google, I love to be able to 
> just hit enter to submit the form after entering the query. However, 
> if the form contains more single line inputs, or heaven forbit, a 
> textarea or two, then it definately does NOT make any sense to submit 
> the form with ENTER key.

It does make sense if the UA is running on Windows or Mac OS, because 
Enter has done the same thing in native dialogs on both those platforms 
for the past 20 years. As far as I know, with the exception of some 
obsolete X11 GUI toolkits, all other GUIs work the same way.

> ...
> Semantically, labels should *always* have connection so some control --

Sure, but this cannot always be reflected in HTML. The most common 
example would be a heading <label> for a set of radio buttons (for 
which <fieldset> would usually be inappropriate).

> I claim that best choice is to leave UA to decide which controls 
> should be focusable via label, though I still think that the correct 
> answer is that all elements are focusable via label.
> ...

So lobby your OS vendor to change the OS behavior. If the OS changes, 
then UAs on that OS can follow suit without causing accidents.

-- 
Matthew Thomas
http://mpt.net.nz/




More information about the whatwg mailing list