HTML: aria-controls

The aria-controls attribute identifies the element whose content a button or other control operates.

What you will learn

Minimal example

<button type="button" aria-controls="menu" aria-expanded="false">
  Menu
</button>
<nav id="menu" hidden>Navigation links</nav>

The value of aria-controls must match the target element’s id. JavaScript should also update aria-expanded and the visible state when the menu opens or closes.

What it does not do

aria-controls does not open, close, or show an element by itself. It only describes the relationship for assistive technology. Use native elements such as details when they already provide the needed behavior.

Common mistakes