Labels for Form Controls Overview
Overview
Form controls must be labelled and grouped to provide explicit references that can be used by assistive technologies to communicate the purpose of the form controls. The tabindex attribute can be used to include instructions and other information in the tab navigation ordering, so that screen reader users can easily orient to information needed to complete the form.
Another important feature of forms is to provide information on errors or the validity of form fields. Many forms provide feedback to the user on whether form fields have been filled out correctly, and there are many ways to provide feedback on fields that need to be updated before the form data will be accepted. The techniques used to provide feedback to users must be carried out in an accessible way, or people with disabilities may not be aware of the problem and/or which form fields need to be updated for the form to be accepted.
Benefits to People with Disabilities
Labeling form controls properly helps people with disabilities:
- understand the purpose of a form control within a web resource,
- identify and understand instructions on how to complete form control content,
- identify form controls with invalid or incomplete content, and
- understand information needed to correct form field with invalid content.
Benefits to All Users
- Labels for checkboxes and radio buttons increase the effective target size for mouse actions to change the state of a checkbox or radio button.
- Consistent feedback on errors and invalid or incomplete form content makes it easier for users to identify the form content that needs to be updated to get the form accepted.
Benefits to Developers
- Centralized and consistent management of form input errors makes it easier to manage the creation and maintenance of web forms.
Related Resources
- Screen reader software support for the TITLE attribute (Vision Australia)
- Assistive technology users test title attribute access (Vision Australia)
HTML Markup Details
labelelement forinput[type="text"],input[type="password"],selectandtextareaelements- The primary way to provide an effective label for a form control is to use the
labelelement using theforattribute to reference theidattribute of the form control. Thelabelelement can also encapsulate form controls, but this technique has problems with many types of assistive technogies. valueattribute forinput[type="button"],input[type="submit"]andinput[type="reset"]- The
valueattribute, defined ininputelement, should provide an effective label forinputelements with thetype="button",type="submit"andtype="reset". altattribute- The
altattribute, should provide an effective label forinputelements with thetype="image". - If the
labelelement content includes animgelement, thealtattribute of theimgelement will be part of the effective label. buttonelement- The text content of the
buttonelement is an effective label; if thebuttonelement content includes animgelement, thealtattribute value of theimgelement will be part of the effective label. titleattribute- The
titleattribute, 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. fieldsetandlegendelements- The
fieldsetandlegendelements are used to add grouping information to effective labels for a group of related html form controls. tabindexattribute- The
tabindexattribute can be used to make important information related to the form, e.g. instructions, part of the TAB navigation order.
Related Accessibility Requirements
- Illinois Information Technology Accessibility Standards
- 10.1 Provide labels or titles for all form fields.
- 10.2 Provide legends for groups of form fields.
- 10.3 Ensure that form fields are in a logical tab order.
- 10.4 Avoid placing non-focusable text between form fields.
- 10.5 Ensure that text in form fields can be enlarged.
- Section 508
- 1194.22 (n) When electronic forms are designed to be completed on-line, the form shall allow people using assistive technology to access the information, field elements, and functionality required for completion and submission of the form, including all directions and cues
- W3C Web Content Accessibility Guidelines 2.0
- 2.4.6 Labels Descriptive: Labels and headings are descriptive.
- 3.3.1 Error Identification: If an input error is detected, the item that is in error is identified and the error is described to the user in text.
- 3.3.2 Labels or Instructions: Labels or instructions are provided when content requires user input.
- 3.3.3 Error Suggestion: If an input error is detected and suggestions for correction are known, then the suggestions are provided to the user, unless it would jeopardize the security or purpose of the content.
- 3.3.4 Error Prevention (Forms including Legal, Financial, Data)
- 3.3.5 Help: Context-sensitive help is available.
- 3.3.6 Error Prevention (All forms)
- W3C Web Content Accessibility Guidelines 1.0
- 10.2 Until user agents support explicit associations between labels and form controls, for all form controls with implicitly associated labels, ensure that the label is properly positioned.
- 12.4 Associate labels explicitly with their controls.
