aria-selected
Indicates that an item inside a single- or multi-select container is currently selected. Used on tab, option, gridcell, treeitem, and similar roles. Distinct from aria-checked (checkbox/radio) and aria-pressed (toggle button).
When to use
On items that belong to a container with a selection model:
role="tab"inside atablist(exactly one selected).role="option"inside alistbox(one or many, depending onaria-multiselectable).role="treeitem"inside atree.role="gridcell",role="row",role="columnheader",role="rowheader"inside agrid.
The state describes the relationship between the item and its container’s selection — not a standalone on/off like a checkbox. Pick the right state for the pattern:
aria-selected— items in a tab, option, tree, or grid context.aria-checked— checkboxes and radio buttons (independent choices).aria-pressed— toggle buttons (the button itself is on or off).
A common mistake is putting aria-selected="true" on a <button> to mean “the user clicked me last”. If the element isn’t part of a select-style widget, use aria-pressed or aria-current instead.
How to keep it in sync
Valid values are "true" and "false". Render "false" on the unselected items rather than omitting the attribute — assistive technology then announces “1 of 5” style position info correctly. In a single-select widget (tablist, single-select listbox), exactly one item at a time should be "true".
The attribute must change in lock-step with the visual indicator and with focus management. In a tablist, moving selection usually also moves tabindex="0" to the selected tab and tabindex="-1" away from the others.
Common failures
- Using
aria-selectedon a button or link outside any select-style container. - Multiple
aria-selected="true"items in a single-select tablist or listbox. - Forgetting to set
aria-selected="false"on the previously selected item when selection moves. - Styling a “selected” appearance via CSS without flipping the attribute.
- Confusing
aria-selectedwitharia-checkedon listbox options (alwaysselected) or witharia-currenton a navigation link (current, notselected). - Setting
aria-selectedonrole="menuitem"— menu items don’t support it; usearia-checkedfor menu checkboxes / radios.
Example
<div role="tablist" aria-label="Sections">
<button role="tab" id="tab-1" aria-selected="true" tabindex="0" aria-controls="panel-1">Overview</button>
<button role="tab" id="tab-2" aria-selected="false" tabindex="-1" aria-controls="panel-2">Details</button>
<button role="tab" id="tab-3" aria-selected="false" tabindex="-1" aria-controls="panel-3">Reviews</button>
</div>