Toggle buttons (aria-pressed) — why this matters

A small UI accessibility note, with an interactive BEFORE/AFTER demo.

Many interfaces use a toggle button for on/off states: mute/unmute, follow/unfollow, equip/unequip, music on/off, and so on.

The catch: if the on/off state is shown only visually (color, a badge, an icon), a screen reader user may only hear “Button” without being told whether it’s currently on or off.

A simple fix: aria-pressed

For a toggle button, expose state by updating aria-pressed:

Screen readers can then announce that the button is pressed / not pressed, and users don’t have to guess from visuals.

Notes

Related: tooltips demo (don’t be hover-only) · toast demo (announce confirmations)