Semantics

A type of checkbox that represents on/off values, as opposed to checked/unchecked values.

Additional info from the ARIA specification

See related checkbox.

The aria-checked attribute of a switch indicates whether the input is on (true) or off (false). The mixed value is invalid, and user agents MUST treat a mixed value as equivalent to false for this role.

Abstract Role

  • WidgetRepresents a focusable, interactive element.

Content Categories

  • Phrasing ContentAn element that typically appears inline and provides semantic meaning to text content.

Allowed Descendants

Phrasing Children Allowed

No interactive content descendants, and no descendants with a tabindex attribute specified.

Note

Children Become Presentational

Browsers automatically apply the presentation role to all descendant elements, so their semantics are not conveyed to assistive technologies.

Usage

Allowed HTML elements

Implicit semantics

  • None

Explicitly allowed

  • a­[href][role=switch]
  • button[role=switch]
  • img[role=switch]
  • input­[type=­checkbox][role=switch]

Elements that can have any role

  • abbr[role=switch]
  • address[role=switch]
  • b[role=switch]
  • blockquote[role=switch]
  • canvas[role=switch]
  • cite[role=switch]
  • code[role=switch]
  • custom-element[role=switch]
  • data[role=switch]
  • del[role=switch]
  • dfn[role=switch]
  • div[role=switch]
  • em[role=switch]
  • figure[role=switch]
  • i[role=switch]
  • ins[role=switch]
  • kbd[role=switch]
  • mark[role=switch]
  • output[role=switch]
  • p[role=switch]
  • pre[role=switch]
  • q[role=switch]
  • samp[role=switch]
  • small[role=switch]
  • span[role=switch]
  • table[role=switch]
  • tbody[role=switch]
  • tfoot[role=switch]
  • thead[role=switch]
  • time[role=switch]
  • u[role=switch]
  • var[role=switch]