aria-expanded & controls Playground

Your disclosure on the Balai’s board used three ways: Wulan clicks, Bayu presses Enter and Space, Mr. Sugeng hears expanded or collapsed, and what does he…

Why it matters

Accordions, dropdowns, hamburger menus, "read more": disclosures are everywhere. Without the right state a screen reader user cannot tell their click worked, and a <div onClick> cannot even be reached by keyboard. It is one of the most often missed accessibility fixes, and one of the cheapest.

The key idea

aria-expanded announces the state, button brings the keyboard

Common mistakes

Try it in this playground