State Properties: aria-expanded and aria-checked
What You'll Learn
You'll learn how to communicate the current state of interactive elements like accordions, dropdowns, checkboxes, and toggle buttons to assistive technologies.
Understanding State Properties
While aria-label and aria-describedby tell users what an element is, state properties tell users how the element currently behaves or appears. Think of them like indicator lights on a dashboard—they announce whether something is open, closed, checked, or unchecked.
aria-expanded
Use aria-expanded to indicate whether a collapsible section is currently expanded or collapsed. This is essential for accordions, dropdown menus, and expandable navigation sections.
aria-expanded="true"— The controlled content is visiblearia-expanded="false"— The controlled content is hidden
Example context: A button controlling an accordion panel should update its aria-expanded value when toggled, so screen reader users know whether clicking will reveal or hide content.
aria-checked
Use aria-checked to communicate the state of checkboxes, radio buttons, and toggle switches—especially custom ones that don't use native HTML inputs.
aria-checked="true"— The option is selected/onaria-checked="false"— The option is not selected/offaria-checked="mixed"— Partially checked (like a parent checkbox when some children are selected)
Example context: A custom toggle button styled as a switch needs aria-checked to announce its on/off state, since it's not a native checkbox element.
When to Update Them
These are dynamic properties—you must update them via JavaScript whenever the user interacts with the element. A static aria-expanded="false" on a button that actually expands content creates a confusing, broken experience.
Key Takeaway: Use aria-expanded for expandable/collapsible content and aria-checked for selection states, and always keep these values synchronized with the actual visual state of your interface.