Form field label
Text close to the form field that indicates the nature, type or format of the information expected. The label can be associated with the form field in several ways:
- by using a
<label>tag; - by using the WAI-ARIA
aria-labelattribute; - by linking the text to the field using the WAI-ARIA
aria-labelledbyattribute; - by using the
titleattribute.
Important note: when several of these techniques are used on the same field, the calculation of the "accessible name", i.e. what will be rendered, follows a strict order:
aria-labelledby;- otherwise
aria-label; - otherwise
<label>; - else
title.
This order must be used to assess the relevance of the label (critère 11.2). For example, even in the case of the presence of a <label>, it is the passage of text referenced by aria-labelledby that should be taken into account.
Reference: Accessible name and description calculation.
Important note about the use of placeholder: when the placeholder attribute is present, it is likely to be returned instead of the title attribute. Consequently, when these two attributes title and placeholder are present, they must be identical.
Note about labels linked with aria-labelledby: these are one or more passages of text identified by ids and linked by aria-labelledby according to the following model: aria-labelledby="ID1 ID2 ID3...".
Note: the aria-label attribute cannot be used to indicate the mandatory nature of a field.
Where this term is used
4 accessibility criteria refer to this definition.
- 11.1 — Does each form input field have a label?
- 11.2 — Is each label associated with a form input field relevant (excluding special cases)?
- 11.3 — In each form, is each label associated with a form input field having the same function and repeated several times in the same page or in a set of web pages consistent?
- 11.4 — In each form, are each field label and its associated field located next to each other (excluding special cases)?