W3C home > Mailing lists > Public > public-wcag2-techs@w3.org > June 2006

Common Failures - Failure due to omitting labels for form controls for item selection or text input

From: WCAG 2.0 Techniques Submission Form <nobody@w3.org>
Date: Tue, 27 Jun 2006 20:50:37 +0000 (UTC)
To: public-wcag2-techs@w3.org
Message-Id: <20060627205037.250BADAE91@w3c4-bis.w3.org>


Submitter's Name: Christophe Strobbe
Submitter's Email: christophe.strobbe@esat.kuleuven.be

Technique ID: UNKNOWN
Short Name: Failure due to omitting labels for form controls for item selection or text input
Technique Category: Common Failures
Guideline Reference: content-structure-separation-programmatic
Success Criterion Reference: UNKNOWN

Applicability:
HTML and XHTML controls that use external labels

UA Issues:
The HTML specification allows both implicit and explicit labels. However, many assistive technologies do not correctly handle implicit labels (for example, &amp;lt;label&amp;gt;First name &amp;lt;input type=&amp;quot;text&amp;quot; name=&amp;quot;firstname&amp;quot;&amp;gt;&amp;lt;/label&amp;gt;).



[This is copied from technique H44: Using label elements to associate text labels with form controls]

Description:
The objective of this technique is to describe a failure that occurs when no label elements are used to explicitly associate a form control with a label. 



[Notes below are copied from H44.]



Note: Elements that use explicitly associated labels are



 * input type=&amp;quot;text&amp;quot;,

 * input type=&amp;quot;checkbox&amp;quot;,

 * input type=&amp;quot;radio&amp;quot;,

 * input type=&amp;quot;file&amp;quot;,

 * input type=&amp;quot;password&amp;quot;,

 * textarea,

 * select.



Note 1: The label element is not used for the following:



 * submit and reset buttons (input type=&amp;quot;submit&amp;quot; or input type=&amp;quot;reset&amp;quot;),

 * image buttons (input type=&amp;quot;image&amp;quot;),

 * hidden input fields (input type=&amp;quot;hidden&amp;quot;),

 * script buttons (button elements or &amp;lt;input type=&amp;quot;button&amp;quot;&amp;gt;).



Note 2: Labels for these elements are implicitly associated via the value attribute (for Submit and Reset buttons), the alt attribute (for image buttons), or element content (button).

Related Techniques:
H44
H65

Test Procedure:
For all input elements of type text, file or password, for all textareas and for all select elements in the Web unit:



   1. check that there is a label element with at least one printable character before the input element;

   2. check that the for attribute of the label element matches the id of the input element.

Expected Result:
If any check above is false, then this failure condition applies and the content fails the success criterion.

Additional Notes:
This also applies to SC 4.1.2. See LC comment 654: http://www.w3.org/WAI/GL/WCAG20/issue-tracking/viewdata_individual.php?id=654.

No example 1 header was submitted!
No example 1 description was submitted!
No example 2 header was submitted!
No example 2 description was submitted!
No resource 1 title submitted!
No resource 1 URI submitted!
No resource 2 title submitted!
No resource 2 URI submitted!
No test file 1 was submitted!
No test file 1 pass/fail was submitted!
No test file 2 was submitted!
No test file 2 pass/fail was submitted!


------------------------------------------------

<technique id="UNKNOWN">
<short-name>Failure due to omitting labels for form controls for item selection or text input</short-name>
<applies-to>
<guideline idref="content-structure-separation-programmatic" />
<success-criterion idref="UNKNOWN" />
</applies-to>

<applicability>
HTML and XHTML controls that use external labels
</applicability>
<ua_issues>
The HTML specification allows both implicit and explicit labels. However, many assistive technologies do not correctly handle implicit labels (for example, &amp;lt;label&amp;gt;First name &amp;lt;input type=&amp;quot;text&amp;quot; name=&amp;quot;firstname&amp;quot;&amp;gt;&amp;lt;/label&amp;gt;).



[This is copied from technique H44: Using label elements to associate text labels with form controls]
</ua_issues>
<description>
The objective of this technique is to describe a failure that occurs when no label elements are used to explicitly associate a form control with a label. 



[Notes below are copied from H44.]



Note: Elements that use explicitly associated labels are



 * input type=&amp;quot;text&amp;quot;,

 * input type=&amp;quot;checkbox&amp;quot;,

 * input type=&amp;quot;radio&amp;quot;,

 * input type=&amp;quot;file&amp;quot;,

 * input type=&amp;quot;password&amp;quot;,

 * textarea,

 * select.



Note 1: The label element is not used for the following:



 * submit and reset buttons (input type=&amp;quot;submit&amp;quot; or input type=&amp;quot;reset&amp;quot;),

 * image buttons (input type=&amp;quot;image&amp;quot;),

 * hidden input fields (input type=&amp;quot;hidden&amp;quot;),

 * script buttons (button elements or &amp;lt;input type=&amp;quot;button&amp;quot;&amp;gt;).



Note 2: Labels for these elements are implicitly associated via the value attribute (for Submit and Reset buttons), the alt attribute (for image buttons), or element content (button).
</description>

<examples>
<ex_head_1>

</ex_head_1>
<ex_desc_1>

</ex_desc_1>
<ex_head_2>

</ex_head_2>
<ex_desc_2>

</ex_desc_2>
</examples>

<resources>
<resources_title1>

</resources_title1>
<resource_uri1>

</resource_uri1>
<resources_title2>

</resources_title2>
<resource_uri2>

</resource_uri2>
</resources>

<related_techniques>
<related_technique>
H44
</related_technique>
<related_technique>
H65
</related_technique>
</related_techniques>

<tests>
<procedure>
For all input elements of type text, file or password, for all textareas and for all select elements in the Web unit:



   1. check that there is a label element with at least one printable character before the input element;

   2. check that the for attribute of the label element matches the id of the input element.
</procedure>
<expected_result>
If any check above is false, then this failure condition applies and the content fails the success criterion.
</expected_result>
<test_file_1>

</test_file_1>
<pass_fail_1>

</pass_fail_1>
<test_file_2>

</test_file_2>
<pass_fail_2>

</pass_fail_2>
</tests>

</technique>

Additional Notes:

This also applies to SC 4.1.2. See LC comment 654: http://www.w3.org/WAI/GL/WCAG20/issue-tracking/viewdata_individual.php?id=654.
Received on Tuesday, 27 June 2006 20:50:33 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 21 March 2011 06:17:05 GMT