On this page

Switch

How Switch meets WCAG 2.2 AA, its keys, what it gives you and what your team does.

Conformance

Switch meets WCAG 2.2 level AA when used as described on this page. It follows the Switch pattern of the WAI-ARIA Authoring Practices.

Keyboard

Key Action
Tab Moves focus to the switch. A disabled switch is skipped.
Space Turns the setting on or off.

What the switch gives you

  • A native <button> with role="switch" and aria-checked, so screen readers say the name and whether it is on.
  • Thumb and label against their track: at least 4.5:1 in every state except disabled, in light and dark. The lowest pair measured is 5.64:1.
  • The OFF edge against its track: at least 3:1 (WCAG 1.4.11). The lowest measured is 3.00:1, OFF on hover in light.
  • The focus ring: at least 6.64:1 against the page, surface, subtle and overlay backgrounds.
  • State shown by the thumb position, not by colour alone.

What your team does

  • Name it. The label says what the setting does: “Sync orders automatically”, not “Enable”. Put the label next to the switch, or set aria-label.
  • Save at once. A switch changes the setting when it is pressed. If saving takes time, show the loading state and say when it is done or when it fails.
  • Don’t change the label to describe the state. “Sync is on” next to an ON switch says the same thing twice.