[whatwg] The legend element
Ian Hickson
ian at hixie.ch
Mon Oct 12 04:48:34 PDT 2009
On Mon, 12 Oct 2009, Markus Ernst wrote:
> Ian Hickson schrieb:
> >
> > > Additionnally I want to suggest to make it possible to place the
> > > legend element outside the fieldset element, providing a "for"
> > > attribute (just as it is possible to place the label element apart
> > > from it's form field element).
> >
> > This is significantly harder to pull off, for the same reason that we
> > haven't been able to use <legend> for <figure>. I recommend we wait
> > for the next version of HTML before doing this.
>
> Would it be possible and easy to allow <label> for fieldsets?
I don't understand the use case.
> This looks somehow consistent to me:
>
> <h2><label for="question1">Favorite pet?</label><h2>
> <fieldset id="question1">
> <p><label><input type="radio" name="q1" value="Cat">Cat</label></p>
> <p><label><input type="radio" name="q1" value="Dog">Dog</label></p>
> <p><label><input type="radio" name="q1" value="Ant">Ant</label></p>
> </fieldset>
Why is this preferable to:
<fieldset>
<legend>Favorite pet?</legend>
<p><label><input type="radio" name="q1" value="Cat">Cat</label></p>
<p><label><input type="radio" name="q1" value="Dog">Dog</label></p>
<p><label><input type="radio" name="q1" value="Ant">Ant</label></p>
</fieldset>
...?
> or:
>
> <label>
> <h2>Favorite pet?<h2>
> <fieldset>
> <p><label><input type="radio" name="q1" value="Cat">Cat</label></p>
> <p><label><input type="radio" name="q1" value="Dog">Dog</label></p>
> <p><label><input type="radio" name="q1" value="Ant">Ant</label></p>
> </fieldset>
> </label>
Why is this preferable to the above?
> > I don't understand why the <fieldset> and <legend> can't be in the
> > template.
>
> That is how I do it now. The downside of it is the fact that some
> themplate authors might forget it - a relevant number of web designers
> in fact don't even know about fieldsets, as forms usually "work" with or
> without them. Anyway it is not a big problem; it would just be a nice
> enhancement of consistency if the template engine were able to output
> *all* form structuring elements.
I don't understand the problem, but if it's not a big problem, then I
would suggest we punt on it until the next version.
--
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