[html5] Question on label as a part of interactive content
Ian Hickson
ian at hixie.ch
Thu Jul 10 12:57:24 PDT 2014
On Wed, 2 Jul 2014, S Partha wrote:
>
> As per the spec
> http://dev.w3.org/html5/spec-preview/content-models.html#interactive-content,
> label element is marked as interactive without any exceptions. Label
> elements are still considered interactive, even if they don't have any
> labeled control. Is there a specific reason to treat labels this way?
Note that the link above is to a really old W3C copy of the spec. Here's
the latest:
http://www.whatwg.org/html#the-label-element
To answer your question, though: it's actually just used as a way to make
it non-conforming to put <label> elements (even labels without controls)
inside <button> elements and <a> elements (and a few other minor cases).
We don't want to allow those because if you ever do associate a control
with such a label element, the result is very confusing to the user. (And
if you've not any intention of ever associating a control with the
<label>, then it's probably wrong to use the <label> in the first place.)
In particular, note that being in the "interactive" category doesn't
actually affect how the element interacts. That's defined separately.
--
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
More information about the Help
mailing list