I've been using implicit form labels just because it's easier to style but according to this page explicit form labels is preferred and implicit is deprecated. I had no idea (I wonder what else I'm behind on).
So, it does mention explicit:
<label for="name">Name: </label> <input id="name" name="name" tabindex="1" />
<label>Name: <input id="name" name="name" tabindex="1" /></label>
but what about both?
<label for="name">Name: <input id="name" name="name" tabindex="1" /></label>
In the last example the label is both implicit and explicit. Is there a word to describe that?
So, since strictly implicit labels are deprecated what about the last example since it does include the explicit for attribute?
As one who automatically
As one who automatically makes the explicit connection, I've not seen the problem, and I see no reason for the two connectives not to live together in harmony. As I see it, though, the issue is not with the implicit connection, but with the assistive technologies' failing to take advantage of the connection. Where html5 is trying to pave every cow path in sight, here we have a broad freeway going directly to the destination, and wcag wants to jackhammer it.
The implicit connection offers a tremendous lift when using DOM scripting, as the label is the parent of the form control. If the implicit nesting is not used, it is much more complex, for example, to tie error messages to the label, for one thing that comes easily to mind.
gary.turner wrote: ... The
... The implicit connection offers a tremendous lift when using DOM scripting, as the label is the parent of the form control. If the implicit nesting is not used, it is much more complex, for example, to tie error messages to the label, for one thing that comes easily to mind. ...
Yes, that's another good reason to use the implicit. I do prefer the implicit labels and have mostly shunned declaring them explicitly just because I believe adding <asp:label> to every input field is just unnecessary overhead when a plain html <label> will do.
Never really understood the
Never really understood the whys and wherefores of this aspect of labeling form controls. Definitely from a styling point of view implicit labels for radios and checkboxes are far easier to style than strangely disconnected labels.
This statement sort of irritates me:
In practice this is not supported by user agents and should not be used.
Yes it is That is a sweeping statement and inaccurate!
However it ought to be stressed that IE < 7? definitely 6 do not support implicit linking and one needs to use the 'for' attribute as well but I always have and apart from adding a little weight to the page don't think it does any harm.
http://green-beast.com/blog/?p=254 (the bug)
Though there was originally mention of it on one of the wcag1 pages... and I still haven't found an answer, if this has been fixed in newer versions of W-E. 5 is pretty old.
I was waiting for that to be
I was waiting for that to be mentioned. It's a sightly different issue though although in the same vein as IE not making the implicit association.
It feels so very wrong to write off whole bits of acceptable code because an application has utterly ballsed things up, but that is somewhat the nature of this game we play *sigh*
Found another one, though
Found another one, though only something to be aware of; how often does one put an image in a label? But if you do...
IE8 doesn't transfer focus to the input.
However the alt text is
However the alt text is linked, just hope that they wouldn't really use this text though
" alt="Image download support must be enabled"
What I note with slight horror and am minded of Opera here is the number of 'Regression bugs' bugs not present in IE7 but I assume are in IE6? So is MS copying Operas behaviour of days gone by where they re-introduced bugs that had been cleared up in previous version
They didn't all ring a bell
They didn't all ring a bell as being IE6 bugs, so, not sure.
Not like FF doesn't add in bugs too. Remember FF 220.127.116.11 where negative margin float tricks (Holy Grail style) pages all died horrid deaths? Somehow that bugger got into the trunk! But at least they covered their ears from the screams and fixed it in 18.104.22.168 : )