--- url: "https://www.w3.org/WAI/WCAG22/Techniques/aria/ARIA9" titulek: "ARIA9: Using aria-labelledby to concatenate a label from several text nodes | WAI | W3C" h1: "Technique ARIA9:Using aria-labelledby to concatenate a label from several text nodes" popis: "" jazyk: "en" kanonicka: "" drobecky: [] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-14 03:49:58" znaku: 9138 slov: 1341 kodovani: "utf-8" sha256: "91df04f316495a2a5b186e5da09938c5fa6d6b72cc35db46e9d995e8b9d04ba3" --- # Technique ARIA9:Using aria-labelledby to concatenate a label from several text nodes ## About this Technique This technique relates to: - [1.1.1 Non-text Content](https://www.w3.org/WAI/WCAG22/Understanding/non-text-content) ( **Sufficient** ) - [3.3.2 Labels or Instructions](https://www.w3.org/WAI/WCAG22/Understanding/labels-or-instructions) ( **Sufficient** when used with [G131: Providing descriptive labels](../general/G131) ) This technique applies to technologies that support [Accessible Rich Internet Applications (WAI-ARIA)](https://www.w3.org/TR/wai-aria/). Techniques are examples of ways to meet Web Content Accessibility Guidelines (WCAG). They are **not required** to meet WCAG. Content can satisfy the normative requirements of WCAG even if it does not use any of the documented techniques. See [About WCAG Techniques](https://www.w3.org/WAI/WCAG22/Techniques/about). ## Description The `aria-labelledby` property can be used to provide a name for all visual objects. Applied to inputs, the `aria-labelledby` property can be used to provide a name to native inputs as well as non-native elements, such as custom text inputs constructed with div contenteditable="true". One particular use of `aria-labelledby` is for text inputs in situations where a meaningful name should consist of more than one text string. Authors assign unique `id`s to the label strings to be concatenated as the name for the `input` element. The value of the `aria-labelledby` attribute is then a space-separated list of all `id`s in the order in which the label strings referenced should be read by screen readers. Supporting user agents will concatenate the label strings referenced and read them as one continuous name for the input. The concatenation of strings can be useful for different reasons. In example 1, an input is nested within the context of a full sentence. The desired screen reader output is "Extend time-out to [ 20 ] minutes - edit with autocomplete, selected 20". Since the `id` of the text input is included in the string of `id`s referenced by aria-labelledby, the value of the input is included in the concatenated name at the right position. Another application of `aria-labelledby` is when there is no space to provide a visible label next to the input, or when using native labels would create unnecessary redundancy. Here, the use `aria-labelledby` makes it possible to associate visible elements on the page as name for such inputs. This is demonstrated in example 2 where table column and row headings are concatenated into names for the text input elements inside the table. Note The [Accessible Name and Description Computation](https://www.w3.org/TR/html-aam-1.0/#accessible-name-and-description-computation) specifies that the string specified in `aria-labelledby` should replace rather than add to the content of the element that carries the property. So adding the `aria-labelledby` property to a native label should replace the text content inside that label unless the label itself is referenced as part of the sequence of `id`s in `aria-labelledby`. ## Examples ### Example 1: A time-out input field with concatenated name A text input allows users to extend the default time before a time-out occurs. The string "Extend time-out to" is contained in a native `label` element and is associated with the input with the input by id="timeout-duration" . This label is associated with this input using the for/id association only on user agents that don't support ARIA. On user agents that support ARIA, the for/id association is ignored and the name for the input is provided only by `aria-labelledby`, per the [Accessible Name and Description Computation](https://www.w3.org/TR/html-aam-1.0/#accessible-name-and-description-computation) in the HTML Accessibility API Mappings 1.0. The `aria-labelledby` attribute on the text input references three elements: (1) the `span` containing the native label, (2) the text input containing the default text '20' (recall that this input is not labelled with the for/id associated label text), and (3) the string 'minutes' contained in a `span`. These elements should be concatenated to provide the full name for the text input ```
| Taxpayer | Spouse | |
|---|---|---|
| W2 Gross | ||
| Dividends |
| Track | Thursday | Friday | ||
|---|---|---|---|---|
| 9 to 12 AM | 2 to 5 PM | 9 to 12 AM | 2 to 5 PM | |
| Track 1 | The Paleozoic era2 places left | The Mesozoic era overview2 places left | The Triassic period, rise of the dinosaurs1 place left | The Jurassic period11 places left |
| Track 2 | The Cretaceous period18 places left | The end of the dinosaurs2 places left | First discoveries of dinosaurs2 places left | Emerging scholarship19 places left |