# Toggle/switch

**Test family:** `SWT`

- **SWT-001** Label describes the setting, while accessible state announces on/off.
- **SWT-002** Initial state reflects persisted truth, not a delayed default that flips after render.
- **SWT-003** Optimistic toggle rolls back and explains failure when save fails.
- **SWT-004** Rapid/repeated toggle sends a coherent final state and no duplicate side effects.
- **SWT-005** A consequential immediate toggle has suitable confirmation or undo; a form-bound toggle waits for submit consistently.
- **SWT-006** Disabled and policy-enforced states explain why and cannot be bypassed.

## Comprehensive per-item coverage

- **SWT-007** Verify absent, loading, initial, default, selected/open, disabled, read-only, invalid, pending, success, and error states are visually and programmatically distinct.
- **SWT-008** Activate with pointer, touch, keyboard, switch control, voice command, and automation APIs; produce one equivalent action per intentional activation.
- **SWT-009** Verify the accessible role, name, description, value/state, relationships, and focus behavior match the visible control.
- **SWT-010** Use adjacent labels or record names containing ASCII emoticons, emoji, kaomoji, RTL text, combining marks, and very long strings; render them safely without breaking activation.
- **SWT-011** Use labels with `&`, `<`, `>`, quotes, slashes, template delimiters, and CSV-formula prefixes; render text inertly in UI, logs, notifications, and exports.
- **SWT-012** Traverse with Tab, Shift+Tab, arrows, Home/End, Enter, Space, Escape, and platform conventions; never trap or unexpectedly move focus.
- **SWT-013** Double-click, double-tap, press Enter repeatedly, and retry after a slow response; prevent duplicate actions and expose truthful progress.
- **SWT-014** Change state while the control is focused, open, offscreen, or being announced; avoid stale accessible state and lost focus.
- **SWT-015** Attempt activation when hidden, disabled, read-only, unauthorized, expired, or stale through both UI and direct requests; enforce the server rule.
- **SWT-016** Interrupt the action with navigation, refresh, offline transition, timeout, server error, and session expiry; recover or roll back coherently.
- **SWT-017** Use two sessions to change the same state simultaneously; define conflict, ordering, and final-state behavior.
- **SWT-018** Reload, revisit, deep-link, back/forward, duplicate the tab, and restore a crashed session; preserve or reset state according to product intent.
- **SWT-019** Test the control inside forms, dialogs, menus, tables, repeated rows, nested landmarks, and virtualized content; keep names and targets unique.
- **SWT-020** Test narrow and wide screens, portrait/landscape, 200% text, 400% reflow, high contrast, reduced motion, and touch target sizing.
- **SWT-021** Translate and lengthen labels, use RTL layout, and change locale while state exists; preserve meaning, order, and action target.
- **SWT-022** Exercise 1, many, and very many repeated controls; keep rendering, interaction, and announcements responsive.
- **SWT-023** Verify analytics, audit events, notifications, and downstream requests occur once, contain the intended target, and omit unrelated sensitive data.
- **SWT-024** Change permissions or ownership between render and activation; reauthorize at commit time and explain rejection without leaking hidden data.
- **SWT-025** Undo, cancel, dismiss, reset, or restore where promised; make irreversible transitions explicit and require an appropriate confirmation/recovery path.
- **SWT-026** Test current and supported browsers/devices plus assistive technology combinations; do not rely on hover, color, animation, or pointer precision alone.

[Back to Choice, action, and navigation controls index](../../controls-choice-action.md)
