How can I show that a control is in a pressed or selected state?
Quick answer
Show a persistent state with both a clear visible appearance and matching programmatic state. For a two-state toggle button, use aria-pressed="true" or aria-pressed="false", keep its accessible label stable, and update the state whenever the toggle changes. Give focus its own visible treatment: a focus outline or brief click effect alone does not show that the control remains on.
The question, the details, the next step.
A practical checklist
Decide whether the control is a persistent toggle, a changing-label command, or another kind of selection control.
For a two-state toggle button, keep its accessible label stable and expose its current state with
aria-pressed.Give persistent on/off state a visible appearance distinct from momentary focus or activation styling.
After each state-changing action, update the programmatic state and visible treatment from the same current value.
Check both states and confirm the displayed value matches the meaning of the selected state.
For suggestion lists or other widgets, use the state appropriate to that widget; do not assume the toggle-button pattern applies.
A few more useful answers
Should I change the button’s label when a toggle is on?
If you use aria-pressed for a toggle button, keep its accessible label stable. A changing label such as “Mute” and “Unmute” is a different command model and does not need aria-pressed in the cited guidance. [S1]
Is a focus outline enough to show that a control is selected?
No. Focus is momentary, while a persistent selected or pressed state remains after interaction. Provide a visible indication of the persistent state as well as appropriate focus styling. [S1]
Does this example prescribe how my selected state must look?
No. The cited button guidance specifies pressed-state semantics but does not prescribe a visual design. Choose a visible treatment that clearly distinguishes the actual states. [S1]
Sources
References used for this guide.
- [S1] WAI-ARIA Authoring Practices Guide: Button Pattern w3.org · Checked
- [S2] WAI-ARIA Authoring Practices Guide: Combobox Pattern w3.org · Checked
