If I have two elements that together describe one element, can I use two ids on aria-describedby
attribute like this?
<div id="description-1"></div>
<div id="description-2"></div>
<div aria-describedby="description-1 description-2"></div>
Like aria-describedby , aria-labelledby can accept multiple ids to point to other elements of the page using a space separated list. This capability makes aria-labelledby especially useful in situations where sighted users use information from the surrounding context to identify a control.
The aria-describedby attribute lists the id s of the elements that describe the object. It is used to establish a relationship between widgets or groups and the text that describes them.
aria-labelledby should reference brief text that provides the element with an accessible name. aria-describedby is used to reference longer content that provides a description.
Generally speaking the attribute aria-describedby provides the screen reader with the additional information to be announced along the content of the element (not the only but the most common use-case).
Yes. The aria-describedby (and aria-labelledby) attribute expects an ID reference list as it's value. Multiple IDs can be provided, separated by spaces. When you associate multiple elements in this way, they are concatenated into a single description string.
A few things to watch out for:
aria-describedby
isn't effective on all elements. In your example the attribute is on a div
element, which generally doesn't work. It works better when used on interactive elements and landmark regions. See Short note on aria-label, aria-labelledby, and aria-describedby for guidance.For further details, see the Accessible Name and Description Computation rules in HTML Accessibility API Mappings 1.0.
Absolutely.
https://www.w3.org/TR/wai-aria/#aria-describedby
Identifies the element (or elements) that describes the object
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With