W3C home > Mailing lists > Public > www-html@w3.org > April 2008

Re: Radio and checkbox texts

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Thu, 24 Apr 2008 08:58:51 +0300
Message-ID: <002801c8a5d0$48a6a300$0500000a@DOCENDO>
To: <www-html@w3.org>

Frank Ellermann wrote:

> Jukka K. Korpela wrote:
>
>> a small monstrosity, requiring pointless invention
>> and use of identifiers.
>
> IIRC it doesn't work as expected for legacy browsers.

That depends on your expectations and your value for "legacy". The use 
of id="..." attributes and <label> elements does not affect the basic 
functionality of a form, and it is currently the most effective way of 
specifying, in markup, the association between fields and their labels, 
but such association is not need for the basic functionality. Rather, it 
is something that accessibility enhancements and possibly automated 
processing of forms could build upon.

>> The logical structure would be to put the input field
>> and its label inside a container, roughly as you can say
>> <label><input type="radio" name="x" value="1">option1</label>
>> at present, but the element namel "label" is quite
>> illogical. (E.g. "field" would be better.)
>
> Related radio buttons in a <fieldset> work, example:

That's a different issue. The <fieldset> element is supposed to group 
fields, not to specify the association inside a field, i.e. the 
association of a label and an input element.

> <fieldset><legend><!-- intentionally void --></legend>

Making <legend> required was a bad decision, and it results in nonsense 
like the above as well as rendering problems (browsers may differ in 
their rendering of empty <legend> elements).

>   <label title="world wide web">
>     <input type="radio" name="meta"
>            value="lr=lang_en|lang_de" checked="checked" />
>     <small> WWW </small> &#160;
>   </label>

Here the association is based on nesting, which is itself logical, as I 
wrote, but the element name is misleading. Here the <label> element 
contains the label _and_ the <input> element. Making it <field> would 
have been more appropriate.

On the pragmatic side, _this_ method of association does not work on all 
currently used browsers as widely as the id="..." and for="..." 
mechanism does.

> That worked with Lynx and a Netscape 2.02 "mozilla 3", the
> titles had of course no effect,

The title attribute is defined as an advisory title, so it could of 
course be displayed or otherwise presented. Browsers don't currently do 
that (but users could set up user style sheets for the purpose), but 
graphic browsers generally display the title attribute value on 
mouseover.

> and the <legend> needed to
> be empty, otherwise Lynx would try to do something "smart".

Huh? I don't see any problem with nonempty <legend> on Lynx. It presents 
the content of <legend> in a heading-like manner. That's how it's 
supposed to be presented, right?

Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/ 
Received on Thursday, 24 April 2008 05:59:33 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:16:13 GMT