This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 10146 - Labelability of hidden form inputs unclear
Summary: Labelability of hidden form inputs unclear
Status: CLOSED FIXED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: pre-LC1 HTML5 spec (editor: Ian Hickson) (show other bugs)
Version: unspecified
Hardware: All All
: P3 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-13 16:51 UTC by Erik Rose
Modified: 2010-10-04 14:48 UTC (History)
4 users (show)

See Also:


Attachments

Description Erik Rose 2010-07-13 16:51:36 UTC
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?
Comment 1 Ian 'Hixie' Hickson 2010-09-07 23:58:40 UTC
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.
Comment 2 contributor 2010-09-07 23:59:41 UTC
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
Comment 3 Erik Rose 2010-10-01 00:05:14 UTC
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!