References

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

The HTML aria-controls attribute

ARIA Accessibility All modern browsers Updated
Quick answer

The aria-controls attribute identifies the element (or elements) that the current control operates on — for example the panel a tab opens or a button toggles. Value: a space-separated list of element id values.

Overview

The aria-controls attribute identifies the element(s) whose contents or presence this element controls.

It is a relationship property: it wires elements together for assistive technology by referencing their ids. The element(s) you point at must exist in the DOM with matching ids, and the relationship is exposed only to assistive technology — it has no visual effect, so you still style and lay out the page normally.

Like all ARIA, aria-controls changes only the accessibility tree — what assistive technology perceives — never the element's behavior or appearance. The first rule of ARIA applies: if a native HTML element or attribute conveys this, use that instead, and only reach for ARIA when nothing native fits.

Syntax

<button aria-expanded="false" aria-controls="menu">Menu</button>
<ul id="menu" hidden> … </ul>

Values

Value
A space-separated list of element id values.

Example

Live example
<button aria-expanded="false" aria-controls="faq1">Question</button>
<div id="faq1" hidden>Answer…</div>

Best practices

  • Follow the first rule of ARIA — use a native HTML element or attribute that conveys this where one exists, rather than adding ARIA.
  • Reference real elements — every target id must exist in the DOM.
  • Remember the relationship is conveyed only to assistive technology and has no visual effect.
  • Prefer native associations (a <label>'s for, a <table>'s structure) where they exist.

Frequently asked questions

What does aria-controls do?
Identifies the element(s) whose contents or presence this element controls.
How does this attribute reference another element?
By its id. The element(s) you point at must exist in the DOM with matching ids.
Does it have any visual effect?
No. It only exposes the relationship to assistive technology; the visible layout is unchanged.
Do I need aria-controls if native HTML already conveys it?
Usually not. ARIA is for what native HTML cannot express; redundant or incorrect ARIA can make accessibility worse. Reach for it only when no native element fits.