[whatwg] The legend element

Ian Hickson ian at hixie.ch
Tue Oct 13 17:04:26 PDT 2009


On Tue, 13 Oct 2009, Markus Ernst wrote:
> Ian Hickson schrieb:
> >
> > I would recommend not using <label> and <fieldset> for rows 2 and 3.
> > 
> > As in:
> > 
> >   Placeholder outputs of 2nd row:
> > 
> >     {label}: What is favourite pet?
> > 
> >     {input-html}:
> >     <p><label><input type="radio" name="Pet" value="Cat">Cat</label></p>
> >     <p><label><input type="radio" name="Pet" value="Dog">Dog</label></p>
> >     <p><label><input type="radio" name="Pet" value="Ant">Ant</label></p>
> > 
> > 
> >   Placeholder outputs of 3rd row:
> > 
> >     {label}: When are you born?
> > 
> >     {input-html}:
> >     <label>Month:
> >      <select name="Month">
> >        <option value="01">January</option>
> >        ...
> >      </select>
> >     </label>
> >     <label>Year: <input type="text" name="Year" size="4"></label>
> > 
> > Why isn't that satisfactory?
> 
> It is, if omitting <fieldset> does not do any harm, such as lower the 
> accessibility of the form.

I don't see why it would, especially in your example where everything is 
in a cell anyway.

> If this is the case, and I read paragraph 4.10.2 of the spec correctly, 
> <fieldset> serves exactly 2 purposes:
> - Adds possibility to group-disable it's descendants
> - Can assign it's descendants to a form, when they are placed outside the form
> element in the code

It also adds the possibility of grouping form controls under a single 
name, and of providing groups of controls for understanding the form.


> Is this correct? Then it might be nice to clarify this with a few words 
> in the spec, as "The fieldset element represents a set of form controls 
> optionally grouped under a common name" can be read as implying 
> structuring and thus accessibility matters.

The element does add structure and help with accessibility, but that 
doesn't mean it's always necessary.

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


More information about the whatwg mailing list