Opens in a new tab

Web design

aria-expanded: how to tell screen readers whether a menu or section is open

What aria-expanded does, where it goes, why navigation dropdowns are disclosures and not menus, and which keys should open and close them.

CheckedNovember 5, 2026
Reading time
Part ofWeb design
Listen to this guide
0:00 /5:22

Short answer: aria-expanded goes on the button that opens and closes something: true while the content is on screen, false while it isn’t. It lets screen readers announce the state. MDN recommends pairing it with aria-controls, and it doesn’t belong on elements that control nothing.

What aria-expanded does

MDN describes aria-expanded as the attribute that indicates whether a control is expanded or collapsed, and so whether the elements it controls are shown or hidden. It goes on the focusable control that toggles them, not on the content.

Menus, dialogs and accordion panels all work this way. aria-controls names the relationship between the control and the content, and aria-expanded gives the state. Native elements such as details and summary report their state without it, as our details and summary guide measured.

Where it goes

Control aria-expanded goes on Also
A show and hide section The button that toggles it aria-controls with the section’s id
A navigation dropdown The button that opens the list of links Usually no menu role: a disclosure button
A menu of actions The menu button aria-haspopup set to menu or true
Content that never collapses Nothing The attribute signals control, so leave it out

Based on MDN and the W3C’s authoring patterns for ARIA, read November 5, 2026.

MDN’s rule for buttons: a button that toggles a widget carries aria-controls with the widget’s id and aria-expanded with its current state. For a menu, the button has aria-expanded set to true while the menu shows, and false or nothing while it is hidden.

The W3C’s navigation example uses the word menu in the everyday sense but avoids the menu role. That role promises the complex keyboard behavior assistive technologies expect from an application menu, which typical site navigation doesn’t need.

So each dropdown is a disclosure: a button that reveals a list of links and carries aria-expanded. Our website navigation guide covers what goes in those lists.

Keys and focus

The W3C disclosure pattern asks for two keys on the button: Enter and Space both open and close the content. Its navigation example adds two details: Escape closes an open dropdown when the focus is inside it, and moving the focus out closes it too.

The state has to follow every way of opening and closing. If a script closes the panel but leaves aria-expanded at true, screen reader users hear an open section that isn’t there. A wrong state is worse than none, as our what is ARIA guide shows.

How to add aria-expanded

  1. Use a button element for the control that opens and closes the content.
  2. Give the content an id and point aria-controls on the button to it.
  3. Set aria-expanded to false while the content is hidden.
  4. Switch it to true when the content shows, and back when it hides.
  5. Use a button so Enter and Space activate it, and let the same script update aria-expanded.
  6. For navigation, follow the W3C example: close the dropdown with Escape and when the focus leaves it.
  7. Check the state in the accessibility tree after each way of opening and closing.

What we found in our own header

On November 5, 2026, we tested the Services button in our header, on the home page and a guide, in both languages. It is a button element with aria-controls pointing to the panel it opens.

A click, Enter and Space all opened and closed the panel, and each time aria-expanded matched what was on screen: true with the panel open, false with it closed. Chrome’s accessibility tree reported the same state.

It also follows the W3C navigation example. Escape closed the open panel and left the focus on the button, and tabbing past the panel’s last link closed it as well.

Before you publish

  • aria-expanded is on the control, not on the content.
  • Its value matches what is on screen after every action.
  • The control points to the content with aria-controls.
  • Navigation dropdowns are disclosure buttons, unless they truly need menu behavior.
  • Enter, Space and Escape behave as expected.
  • Elements that control nothing don’t carry aria-expanded.

Rememberaria-expanded is a promise about what is on screen. Put it on the button, keep it true only while the content shows, and test every way of closing.

Our web design service builds menus and panels that report their state this way.

Quick answers about aria-expanded

What does aria-expanded do?

It tells assistive technology whether a control is expanded or collapsed, and so whether the content it controls is shown or hidden. MDN describes it this way, and a screen reader can announce the state when people reach the control.

Where does aria-expanded go?

On the control that opens and closes the content, usually a button, not on the content itself. MDN adds that the button should carry aria-controls with the id of the content it toggles.

Should a navigation dropdown use the menu role?

Usually not. The W3C’s navigation example uses disclosure buttons instead, because typical site navigation doesn’t need the complex keyboard behavior that assistive technologies expect from a menu.

Which keys should open and close a disclosure?

Enter and Space, according to the W3C disclosure pattern. In its navigation example, Escape also closes an open dropdown when the focus is inside it, and moving the focus out closes it too.

Can I put aria-expanded on any element?

Only on elements that control something that expands. MDN warns that the attribute signals control, so it shouldn’t appear on elements that don’t open or close anything.

Sources

Read on November 5, 2026. MDN Web Docs: ARIA: aria-expanded attribute. W3C Web Accessibility Initiative: Disclosure (Show/Hide) Pattern, Example Disclosure Navigation Menu and Menu Button Pattern. Our case: our own pages, read in a browser on November 5, 2026.

Pedro Galindez

Pedro Galindez

Founder of Feedback Studios, a bilingual growth studio in Miami.

Listen0:00 /5:22

More guides

Checked November 5, 2026

HTML dialog: how to build an accessible modal window

What the dialog element does, the difference between show() and showModal(), where the focus goes, how people close it and what a custom modal must rebuild.

Checked November 5, 2026

aria-live: how to make screen readers announce changes on the page

What aria-live does, polite versus assertive, why the region must exist before its message, aria-atomic, and the roles that are live regions already.

Checked November 3, 2026

Interaction to Next Paint (INP): what it is and how to fix slow interactions

What INP counts, the three parts of an interaction, how to fix slow interactions and what a lab test showed on our pages.

Checked November 3, 2026

JavaScript SEO: how Google renders your pages and what to check

How Google crawls, renders and indexes JavaScript pages, what scripts can change, the checks to run and what our own pages send before JavaScript runs.

Next step

Tell us what you need

Write to us on WhatsApp or send us a message. We answer in English or Spanish.