{
  "componentId": "switch",
  "componentName": "Switch",
  "lastReviewed": "2026-05-03",
  "keyboardWalk": [
    {
      "keys": "Tab",
      "expected": "Focus moves to the input. Focus ring renders on the track or wrapping label per design system convention. Switch is its own tab stop."
    },
    {
      "keys": "Space (input focused)",
      "expected": "Toggles the state. Off → on, on → off. `aria-checked` flips and the thumb translates. Per APG, Space is canonical; Enter is optional (most libraries accept both for symmetry with other interactive controls)."
    },
    {
      "keys": "Enter (input focused)",
      "expected": "Optional toggle per APG. Most implementations bind Enter to toggle for symmetry; some restrict to Space only. Document the choice."
    }
  ],
  "announcements": [
    {
      "trigger": "SR encounters an off switch",
      "expected": "\"Switch, [label text], off\". The role, accessible name, and state are all announced. Some SR announce \"off\" as \"not pressed\" or \"unchecked\" depending on the SR's switch-handling — the role announces as \"switch\" when supported."
    },
    {
      "trigger": "SR encounters an on switch",
      "expected": "\"Switch, [label text], on\"."
    },
    {
      "trigger": "User toggles the switch",
      "expected": "SR announces the new state — \"on\" / \"off\". The label text does NOT announce again because it has not changed (per APG constant-label rule)."
    }
  ],
  "axeRules": [
    "aria-allowed-attr",
    "aria-required-attr",
    "aria-valid-attr-value",
    "label",
    "color-contrast"
  ],
  "_about": "Per-component a11y-acceptance data shaped for direct ingestion into Playwright + @axe-core/playwright or Jest + jest-axe.\n\nSuggested wiring:\n- axeRules → pass to AxeBuilder.options({ runOnly: { type: \"rule\", values: axeRules } }) so the run targets only the rules the canon has pinned for this component (other rules can run in your global pass).\n- keyboardWalk → iterate the entries; each `keys` is a human-readable sequence (e.g. \"Tab → Tab → Esc\"). Translate to page.keyboard.press calls and assert `expected` against the result (focused element, aria-state, visible text, etc.).\n- announcements → assert text content of any aria-live region or capture the accessibility tree at the trigger moment and match against `expected`.\n\nEmpty sub-arrays mean the canon does not yet pin behaviour for that axis on this component, not that none is required."
}