Element: ariaDescribedByElements property
Baseline 2025Newly available
Since April 2025, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
TheariaDescribedByElements property of theElement interface is an array containing the element (or elements) that provide an accessible description for the element it is applied to.The accessible description is similar to the accessible label (seeariaLabelledByElements), but provides more verbose information.
Thearia-describedby topic contains additional information about how the attribute and property should be used.
In this article
Value
An array of subclasses ofHTMLElement.The inner text of these elements can be joined with spaces to get the accessible description.
When read, the returned array is a static and read-only.When written, the assigned array is copied: subsequent changes to the array do not affect the value of the property.
Description
The property is a flexible alternative to using thearia-describedby attribute to set the accessible description.Unlikearia-describedby, the elements assigned to this property do not have to have anid attribute.
The property reflects the element'saria-describedby attribute when it is defined, but only for listed referenceid values that match valid in-scope elements.If the property is set, then the corresponding attribute is cleared.For more information about reflected element references and scope seeReflected element references in theReflected attributes guide.
Examples
>Get the accessible description
This example shows howariaDescribedByElements can be used to get the accessible description defined usingaria-describedby.
HTML
The HTML defines two<span> elements and references their ids in thearia-describedby attribute of a<button>.
<button aria-describedby="trash-desc1 trash-desc2">Move to trash</button>…<span>Trash will be permanently removed after 30 days.</span><span>Or Else!</span><pre></pre>CSS
Here we'll just hide the<span> elements that contain our accessible text.
span { display: none;}#log { height: 70px; overflow: scroll; padding: 0.5rem; border: 1px solid black;}JavaScript
The code below first logs the value of thearia-describedby attribute fromElement.getAttribute() (a string listing theid values of the referenced elements).It then checks whether theariaDescribedByElements is supported, and if so, logs its value.Finally it returns the accessible string, calculated by iterating through the returned elements and concatenating their inner text.
const logElement = document.querySelector("#log");function log(text) { logElement.innerText = `${logElement.innerText}${text}\n`; logElement.scrollTop = logElement.scrollHeight;}const buttonElement = document.querySelector("button");log(`aria-describedby: ${buttonElement.getAttribute("aria-describedby")}`);// Feature test for ariaDescribedByElementsif ("ariaDescribedByElements" in Element.prototype) { // Get ariaDescribedByElements const buttonElements = buttonElement.ariaDescribedByElements; log(`ariaDescribedByElements: ${buttonElements}`); // Accessible description from the elements const text = buttonElements.map((e) => e.textContent.trim()).join(" "); log(`Accessible description: ${text.trim()}`);} else { log("element.ariaDescribedByElements: not supported by browser");}Result
The log below shows the original element references, the associated/returned elements, and the accessible description.
Specifications
| Specification |
|---|
| Accessible Rich Internet Applications (WAI-ARIA)> # dom-ariamixin-ariadescribedbyelements> |
Browser compatibility
See also
aria-describedbyattributeElementInternals.ariaDescribedByElements- Reflected element references in theAttribute reflection guide