Print this page

aria-pressed

Characteristics

Type:

  • String

Used in Roles:

  • button

See Related:

  • aria-checked
  • aria-selected

Value:

  • tristate
    • true: The element is down (button pressed).
    • false: The element supports being pressed but is not currently pressed.
    • mixed: Indicates a mixed mode value for a tri-state toggle button.
    • undefined (default): The element state is unknown.

Sets or retrieves the pressed state of a button that can be toggled.

Buttons with a defined aria-pressed state can be toggled. (When aria-pressed is true the button is down, when false it is up.) Simple command buttons should not define a aria-pressed state.

Toggle buttons require a full press-and-release cycle to change their value. Activating it once changes the value to true, and activating it another time changes the value back to false. A value of mixed means that the values of more than one item controlled by the button do not all share the same value.  If the attribute is not present, the button is not a toggle button.

The aria-pressed attribute is similar but not identical to the aria-checked attribute. Operating systems support pressed on buttons and checked on checkboxes.

Note  The presence of the aria-pressed attribute affects the behavior of accessibility and automation tools. The attribute should not be used carelessly.

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-pressed="p" ... >
JavaScript
object.setAttribute("aria-pressed",value);var value = object.getAttribute("aria-pressed");

Microsoft Active Accessibility Properties:

  • STATE_SYSTEM_PRESSED (get_accState)

UI Automation Properties: 

  • ToggleState (Toggle Pattern)

UI Automation AriaProperties Property:

  • pressed