Re: use cases for <label>

Andrew Fedoniouk writes:

> On Sat, Jul 6, 2013 at 1:04 AM, Steve Faulkner
> <faulkner.steve@gmail.com>wrote:
> 
> > are there any uses cases for the <label> element[1] that does not
> > label a control?

I can't think of any ... but obviously it's hard to prove a negative.

> > <label>name</label> <input type="text">
> >
> > in the case above the label element is not associated with the input
> > using for/id or via wrapping.
> >
> > It does not appear to do anything, so why should it be conforming?
> > would it be helpful to authors/users if this was flagged as an error

I think so.

It's already an error if the <label> has a for attribute and there isn't
an element with a corresponding id, or the element with that id isn't a
form element.

> "label" is quite universal term and it make sense I think to keep it
> in generic form.

But it doesn't currently have generic behaviour; the only thing it
causes user agents to do is associate a label with a form control.

> We do not have currently any element that can be used as a
> label/caption universally.

True. But what would such an element do.

> For example I would like to give caption to some <canvas> element.

What's in the <canvas>? <canvas> is merely a means to an end; the thing
being captioned is what's shown to the user on the canvas.

> What element can I use now for that?
> 
> As for me this:
> 
> <div .graph>
>   <label>sin(x)/x graph:<label>
>   <canvas />
> </div>
> 
> looks as the only option for now.

That looks to me like a figure. You could use <figure> instead of the
<div> and <figcaption> for the caption.

Moreover, what do you think the <label> in the above is achieving?
Surely in terms of how user agents interpret it, it's being treated as
though you had used <span>?

> <figcaption> (what an ugly name someone invented...)

It was a compromise, agreed by a committee, and quite possibly nobody's
first choice. All other names had some problems with them.

Cheers

Smylers
-- 
Stop drug companies hiding negative research results.
Sign the AllTrials petition to get all clinical research results published.
Read more: http://www.alltrials.net/blog/the-alltrials-campaign/

Received on Monday, 8 July 2013 08:45:02 UTC