This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
When labeling a hidden input element in an HTML 5 document, the validator at http://validator.w3.org/check returns the following error: "The for attribute of the label element must refer to a form control." Further discussion with the good folks who maintain the validator (http://bugzilla.validator.nu/show_bug.cgi?id=755), spilling over into the IRC exchange excerpted therein, suggests that the intent of the HTML 5 spec is that type=hidden inputs should not be labelable. This makes sense to me, since the intent is to pass focus from the label to the labeled element, but I do think the spec could benefit from some clarification. In particular, according to http://www.w3.org/TR/html5/forms.html#the-label-element, one can label any "labelable form-associated element", one of which is "input". I couldn't find any exceptions to this, for example at http://www.w3.org/TR/html5/states-of-the-type-attribute.html#hidden-state. Perhaps we could add something along the lines of "input (with a type attribute having a value other than hidden)" to the section at http://www.w3.org/TR/html5/forms.html#category-label : Labelable elements Denotes elements that can be associated with label elements. button input keygen meter output progress select textarea ...and also a note in http://www.w3.org/TR/html5/states-of-the-type-attribute.html#hidden-state . Thoughts?
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document: http://dev.w3.org/html5/decision-policy/decision-policy.html Status: Partially Accepted Change Description: see diff given below Rationale: I added this constraint and noted it in the definition of "labelable". I didn't note it anywhere else so far, because the same constraint for "Interactive content" wasn't mentioned there either.
Checked in as WHATWG revision r5432. Check-in comment: Disallow <label> to be used with <input type=hidden>. http://html5.org/tools/web-apps-tracker?from=5431&to=5432
Looks great. To be totally pedantic, I noticed a missing space after the colon in "in the Hidden state:Listed". Thanks for the quick attention!