HTML ARIA States and Properties
Prefer native state
A native checkbox exposes its checked state automatically. ARIA states describe an interface; they do not change the underlying control. Avoid duplicating native checked with aria-checked.
<label> <input type="checkbox" checked> Receive updates</label>Activate the checkbox and observe the changed checked state.
Synchronize a toggle button
aria-pressed describes a toggle button, not an ordinary momentary action. Keep its name stable and update the attribute when the real setting changes. Here a click listener switches the state and a visible message.
<button id="mute" type="button" aria-pressed="false">Mute</button><p id="state">Sound on</p><script> const button = document.getElementById("mute"); button.addEventListener("click", () => { const muted = button.getAttribute("aria-pressed") !== "true"; button.setAttribute("aria-pressed", String(muted)); document.getElementById("state").textContent = muted ? "Sound off" : "Sound on"; });</script>Click Mute to switch the simulated sound setting and the pressed state. No audio plays.
Communicate updates
An already-present live region can expose subsequent text changes. Use role="status" for ordinary updates, or aria-live="polite" on an appropriate container. Avoid frequent or redundant announcements. The example updates a message without moving focus.
<button type="button" id="save">Save draft</button><p id="message" role="status"></p><script> document.getElementById("save").addEventListener("click", () => { document.getElementById("message").textContent = "Draft saved locally (demo)."; });</script>Activate Save draft to update the status. This demo does not persist a draft; actual announcement depends on assistive technology.
Common mistakes and practice
aria-expanded describes whether controlled content is expanded; aria-selected applies to roles that support selection, not every chosen item. Do not place aria-hidden="true" on focusable controls. Use native hidden or inert when appropriate and test visibility and focus together.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
HTML ARIA States and Properties — Knowledge Check
Apply the accessibility concepts taught in this lesson.
Does aria-checked change a native checkbox value?
Which state describes a toggle button?
When should the pressed state change?
Which role is appropriate for an ordinary status update?
Which attribute is unsafe on a focusable control?