A A A A A

Labels for Form Controls Rules

HTML Markup Details

label element for input[type="text"], input[type="password"], select and textarea elements
The primary way to provide an effective label for a form control is to use the label element using the for attribute to reference the id attribute of the form control. The label element can also encapsulate form controls, but this technique has problems with many types of assistive technogies.
value attribute for input[type="button"], input[type="submit"] and input[type="reset"]
The value attribute, defined in input element, should provide an effective label for input elements with the type="button", type="submit" and type="reset".
alt attribute
The alt attribute, should provide an effective label for input elements with the type="image".
If the label element content includes an img element, the alt attribute of the img element will be part of the effective label.
button element
The text content of the button element is an effective label; if the button element content includes an img element, the alt attribute value of the img element will be part of the effective label.
title attribute
The title attribute, supported by most form control elements, is the secondary way to provide an effective label for html form controls. When a set of form controls are laid out in columns or rows, the appropriate effective label for several controls should be at the beginning of the row or the top of the column.
fieldset and legend elements
The fieldset and legend elements are used to add grouping information to effective labels for a group of related html form controls.
tabindex attribute
The tabindex attribute can be used to make important information related to the form, e.g. instructions, part of the TAB navigation order.

Definitions

Effective Label
The effective label of a form control is the text content communicated to assistive technologies to identify the purpose of the form control on a web page. Effective label is critical in order for users of assistive technologies, especially screen reader, to have meaningful labels that will inform them the purpose of the form control.
When effective label for a form control is not defined in the mark up, assistive technologies try to guess an effective label based on the position of text that is near the form control. This leads to forms that are difficult or impossible to complete since the effective label content will be incomplete or misleading.
The effective label of a form control is calculated from the content from one of the following sources: label, button, input.title, input.alt and input.value. The calculation can also include content from the legend element and img.alt attribute of img elements contained in label and button elements. The text of the effective label should be meaningful and uniquely identify the purpose of the form control. For more information on the calculation of the effective label, view description under Accessibility Evaluation Rule #5.

Accessibility Evaluation Rules

Form Control Labeling Evaluation Rules
no. FAE 2007 FAE 2008 Description
1 N/A Pass/Fail

The elements input[type="text | password | checkbox | radio | file"], select and textarea must have:

  1. label element content that has the label.for attribute referencing the id attribute of the form control element, or
  2. title attribute content on the form control element itself.

Implementation Information

  • If both label element and title attribute are specified, the label element will override the title attribute.
  • Each label element references an id attribute on the web page.
  • Each id attribute value of a form control element within a web page must be valid and unique.
  • The label element should not encapsulate select and textarea elements. The text child nodes of a textarea element content that the user entered and option element content of a select element will be included as part of the effective label.
  • For web pages with densely packed form controls, label elements can be hidden from the visual rendering using CSS techniques of absolute positioning. (ex. Survey form using hidden labels, Date picker using hidden labels)
  • The use of the title attribute as the label of a form control should generally be avoided, but may be useful in cases where form controls are densely packed and the use of visually rendered or hidden label elements is inconvenient, or where the label information is useful as a tooltip. (ex. Date picker using title)
2 N/A Pass/Fail

The element input[type="image"] must have:

  1. alt attribute content on the form control element itself, or
  2. title attribute content on the form control element itself.

Implementation Information

  • If both title attribute and alt attribute are specified, the title attribute will override the alt attribute.
  • title attribute should be meaningful even when it is specified with the purpose of providing a tooltip for an image in addition to the alt attribute, as it will override the alt attribute and also be the effective label.
3 N/A Pass/Fail

The elements input[type="button" | submit | reset"] must have:

  1. value attribute content on the form control element itself, or
  2. title attribute content on the form control element itself.

Implementation Information

  • If both title attribute and value attribute are specified, the title attribute will override the value attribute.
  • When there are more than one input[type="button | submit | reset"] elements of one type, all with the same value attribute, on a page, the title attributes can be used to differentiate the effective labels of the form controls.
4 N/A Pass/Fail

Each label and legend element must contain content and the content should help to identify the purpose of the form control on the web page. If the title attribute is defined for an input. select, textarea or button element it must also contain content since it will be used by assistive technologies as part of the effective label for the form control.

Implementation Information

  • Content must contain at least three printable characters
5 N/A Pass/Warning

Each effective label within a web page should be unique.

Implementation Information

The calculation of effective label primary content:

  1. effective label = BUTTON
  2. effective label = LABEL
  3. effective label = TITLE
  4. effective label = ALT
  5. effective label = VALUE

Note: If more than one primary source of content is defined for a form control element, only one of the sources will be used for the pimrary content and other sources will be ignored. The possible primary sources in the above list are in the same order as the order of precedence.

effective label modifications:

  • If the form control is contained in a fieldset element with an associated legend element, the legend element content becomes part of the effective label according to the following formulas:
    1. effective label = LEGEND + BUTTON
    2. effective label = LEGEND + LABEL
    3. effective label = LEGEND + TITLE
    4. effective label = LEGEND + ALT
    5. effective label = LEGEND + VALUE
  • If an img element with an alt attribute is contained in a label of button element, the content of the alt attribute is inserted into the label or button content in the order of appearance in the document to become part of the effective label.
  • If multiple label elements reference the same form control, their contents are concatenated in the order of appearance in the document to become part of the effective label.
6 N/A Pass/Check

Text content that cannot receive the focus should not be placed between form controls.

  • Text instructions on filling out the form should be placed before the form. h2 or other heading element that includes the word "Instructions" should be used at the beginning of the instructions.
  • If placing text content between form controls cannot be avoided, the text content can be included in the tabbing order by doing the following: Put a tabindex attribute with the value of "0" on an a element and use the anchor element as the container element for the text content. The href attribute should reference the id attribute content of the link.

    Example: <span><a id="inst1" tabindex="0" href="#inst1">... instructions ...</a></span>

    This ensures screen reader users in forms mode will hear the instructions as they TAB through the form controls.
7 N/A Pass/Check

The elements input, select, textarea and button should allow text size to change with the zoom setting of the browser.

  • CSS font-size property can be usedto set the font size to 100%

    Example: input, select, textarea, button { font-size: 100%; }
8 N/A Check

Required form controls should have the word "required" as part of the effective label.

  • For form controls with effective labels calculated from label or legend elements, the word "required" can be included by using one of the following techniques:
    1. Use an img element with the alt attribute content that includes the word "required". (ex. Subscription form with required fields)
    2. Include the word "required" as part of the label or legend element content.
    3. Use the * or other special character with an abbr element and include the word "required" as part of the title attribute content of the abbr element.

      Example: <abbr title="required">*</abbr>
  • For form controls with effective labels calculated from the title attributes, the word "required" can be included as part of the title attribute content.
9 N/A Check

Invalid form controls should have the word "invalid" as part of the effective label.

  • For form controls with effective labels calculated from label or legend elements, the word "invalid" can be included using one of the following techniques:
    1. Use an img element with the alt attribute content that includes the word "invalid". (ex. Subscription form with invalid field feedback)
    2. Include the word "invalid" as part of the label or legend element content.
    3. Use the * or other special character with an abbr element, and include the word "invalid" as part of the title attribute content of the abbr element.

      Example: <abbr title="required">*</abbr>
  • For form controls with effective labels calculated from the title attributes, the word "invalid" can be included as part of the title attribute content.
10 N/A Check

When content of a form is validated as the user submits the form, a response page should follow that provides a list of links with each link text describing the problem each invalid form field of the form has:

  • ol and li elements can be used to create a list of links, i.e. a elements, with the href attribute content that references the id attribute content of the associated form control. Selecting the link places the focus on the form control with the problem mentioned in the link text. (ex. Subscription form with required fields, Subscription form with invalid field feedback)
  • A heading element, i.e. h2-h6 elements, should immediately precede the list of links.
11 N/A Check

When content of a form is validated as the user fills out each form field, an alert box must indicate if the input is invalid as the user tries to move the focus to the next form control.

12 N/A Check

Ensure that form fields are in a logical tabbing order.

  • The default tabbing order of form controls is defined by the order of appearance of the controls in the web page.
  • The tabindex attribute can be used to change the tabbing order order of form controls.
13 Pass/Fail N/A Each form control label within a web page must have an associated label element.

FAE Rule Implemetation

FAE 2007
The Illinois Functional Accessibility Evaluator (FAE) currently implements FAE 2007 rules.
The Illinois Firefox Accessibility Extension currently implements these rules.
FAE 2008
The FAE 2008 rules are designed to optimize the rules for implementation of Section 508, W3C User Agent Accessibility Guidelines and Illinois Information technology Accessibility Act requirements and are based on the requirements of these standards and experience with the problems of FAE 2007.
Illinois Functional Accessibility Evaluator Implementation of FAE 2008 rules is currently under development.
The Illinois Firefox Accessibility Extension currently implements some of these rules.

Navigation

Other HTML Best Practices

Working Group