aria-selected
Characteristics
Type:
- String
Used in Roles:
- gridcell
- option
- row
- tab
Inherits into Roles:
- columnheader
- menuitemradio
- radio
- rowheader
- treeitem
See Related:
- aria-checked
- aria-pressed
Value:
- true/false/undefined
- true: The element is selected.
- false: The element is not selected.
- undefined (default): The element state is unknown.
Sets or retrieves the selection state of the element.
This attribute is used with single-selection and multiple-selection widgets:
- Single-selection containers where the currently focused item is not selected. The selection normally follows the focus, and is managed by the user agent.
- Multiple-selection containers. Authors should ensure that any selectable descendant of a container in which the aria-multiselectable attribute is true specifies a value of either true or false for the aria-selected attribute.
Any explicit assignment of aria-selected takes precedence over the implicit selection based on focus. If no DOM element in the widget is explicitly marked as selected, assistive technologies may convey implicit selection which follows the keyboard focus of the managed focus widget. If any DOM element in the widget is explicitly marked as selected, the user agent must not convey implicit selection for the widget.
Note For cross-browser compatibility, always use the aria attribute syntax to access and modify aria properties, for example object.setAttribute("aria-valuenow", newValue).
Syntax
HTML <element aria-selected="p" ... > JavaScript object.setAttribute("aria-selected",value);var value = object.getAttribute("aria-selected");
Microsoft Active Accessibility Properties:
- STATE_SYSTEM_SELECTED (get_accState)
UI Automation Properties:
- IsSelected (SelectionItem Pattern)
UI Automation AriaProperties Property:
- selected