References

Beginner-friendly references for web development, with live, editable examples.

The HTML aria-details attribute

ARIA Accessibility
In short

Through aria-details, an element points at fuller content, such as a chart's data table, by id. Assistive technology can then tell users the detail exists and take them to it. Unlike a description, the referenced content isn't flattened to a string, so its structure survives.

Overview

The aria-details attribute connects an element to a separate element with more detailed information about it. Its presence lets assistive technologies make users aware of that information and navigate to it. The attribute is global, and it supplies no accessible name.

The referenced content stays intact. It's left out of the accessible description computation, so a table isn't flattened to a string and keeps its rows. The element gets a relation to the target, and aria-details adds nothing to its description.

The value depends on the version. WAI-ARIA 1.2 allows one id, while the 1.3 Working Draft of June 4, 2026 allows a list, so a paragraph can reference several unrelated comments.

The target should stay in the accessibility tree, visible to all users. Chrome and Firefox drop the relation when the target uses hidden, display: none, visibility: hidden or aria-hidden, or sits inside a closed <details>, but keep it for an off-screen target or a closed <details> itself.

The 1.3 draft lets the target's role say what kind of detail it is. A comment role means a comment, and a term pointing at a definition role means a definition. A figure's caption, a doc-footnote and a doc-endnote work the same way, and any other role is a general annotation.

Syntax

<img src="sales.png" alt="Sales by quarter" aria-details="sales-data">
<details id="sales-data">
  <summary>Sales table</summary>
  <p>Q1 was $120k and Q2 was $240k.</p>
</details>

Values

Value
One element id, or a list of ids in the WAI-ARIA 1.3 draft.

Example

Live example
<p style="margin: 0 0 6px">Open the table. The chart points at it either way.</p>
<svg role="img" aria-label="Sales by quarter" aria-details="sales-data" width="96" height="40" viewBox="0 0 96 40">
  <rect x="0" y="20" width="40" height="20" fill="#1e72e0"/>
  <rect x="52" y="0" width="40" height="40" fill="#1e72e0"/>
</svg>
<details id="sales-data">
  <summary>Sales by quarter</summary>
  <table>
    <tr><th>Quarter</th><th>Sales</th></tr>
    <tr><td>Q1</td><td>$120k</td></tr>
    <tr><td>Q2</td><td>$240k</td></tr>
  </table>
</details>
<p role="status" id="out" style="margin: 6px 0 0">aria-details points at sales-data, which is closed.</p>
<script>
const target = document.getElementById('sales-data');
target.addEventListener('toggle', function () {
  const id = document.querySelector('svg').getAttribute('aria-details');
  document.getElementById('out').textContent = 'aria-details points at ' + id + ', which is ' + (target.open ? 'open.' : 'closed.');
});
</script>

Best practices

  • Give the element a short name as well, such as an image's alt text, because aria-details doesn't supply one.
  • Reference a <details> element itself, not something inside it.
  • Point at one wrapper when several comments apply. The 1.3 draft allows that, and says a container of comments should have the group or region role.
  • Use one id if you must conform to the 1.2 Recommendation, whose value type is a single ID reference, not a list.

Frequently asked questions

When should you pick aria-details over aria-describedby?
Pick aria-details when turning the content into a string would lose information, as with a table. Consider aria-describedby instead if the content is short and flattening costs nothing.
Is aria-details related to the HTML details element?
No, aria-details is an ARIA relationship, while details is an HTML disclosure element. A details element can still be the target, holding the extended content.
Can aria-details link to another page?
Not directly, because aria-details takes element ids. Point it at a link on the page instead, and that link can lead to the extended description.
Does a popover get aria-details automatically?
A popover's show or toggle button gets an aria-details relation to the popover, under the HTML-AAM draft. Chrome and Firefox expose it only while the popover is open, and the draft makes exceptions such as a popover that directly follows the button.
How does aria-details relate to the longdesc attribute?
The aria-details attribute serves a similar purpose to longdesc, which was never fully supported and was deprecated. The difference is the value, since longdesc held a URL and this attribute holds ids.
Can an element use aria-details and aria-describedby together?
Yes, using aria-details with a description is valid, and both are exposed. Where an accessibility API holds only one relation, the 1.3 draft says the browser should expose the aria-details relation and the description string.