feat(switch): token mapping updates for s2-foundations#6065
feat(switch): token mapping updates for s2-foundations#6065marissahuysentruyt wants to merge 10 commits intomainfrom
Conversation
|
📚 Branch Preview Links🔍 First Generation Visual Regression Test ResultsWhen a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:
Deployed to Azure Blob Storage: If the changes are expected, update the |
- adds `--spectrum-switch-border-color-*` tokens to control the switch track border across all selected interaction states (needs to preserve s1/express and introduce new style behaviors in s2-foundations) - adds full set of emphasized selected handle border color tokens - set transparent border colors for s1/express where the track border is not visible
Description
--system-switch-*variables from the three system-theme-bridge files (Spectrum, Express, tokens-v2).switch-overrides.cssmaps these to--spectrum-switch-*on:hostso track/handle colors, border colors, and background colors are theme-specific.--spectrum-switch-border-width-themed(wired to--system-switch-border-width-themed) so the track border can differ by theme:--system-switch-border-width-themed: 0px(no track border; consistent borderless style).--system-switch-border-width-themed: var(--spectrum-border-width-200)(visible track border for S2).--mod-switch-border-width-themed/--spectrum-switch-border-width-themedinstead of the previous border-width token where theme-specific behavior is required. Handle border remains on the global token for the handle’s own border.tokens/spectrum,tokens/express,tokens-v2) define the same set of--system-switch-*tokens (handle border colors, track/handle backgrounds, disabled/emphasized states, border-width-themed). Spectrum and Express use 0px track border and theme-appropriate grays; tokens-v2 uses--spectrum-border-width-200and lighter handle borders (e.g. gray-25).switch.cssfrom--highcontrast-switch-handle-border-color-selelcted-downto--highcontrast-switch-handle-border-color-selected-downso forced-colors styling applies correctly for the selected-down state.Motivation and context
forced-colorsusers see the correct handle border in the selected-down state.Related issue(s)
Screenshots (if appropriate)
N/A — styling only. Recommend comparing Switch in Storybook under Spectrum, Express, and Spectrum Two themes (default and emphasized, default and disabled).
Author's checklist
Reviewer's checklist
patch,minor, ormajorfeaturesManual review test cases
Switch in Spectrum theme
Switch in Express theme
Switch in Spectrum Two theme
High-contrast (forced-colors)
Device review
Accessibility testing checklist
Required: Complete each applicable item and document your testing steps (replace the placeholders with your component-specific instructions).
Keyboard (required — document steps below) — What to test for: Focus order is logical; Tab reaches the component and all interactive descendants; Enter/Space activate where appropriate; arrow keys work for tabs, menus, sliders, etc.; no focus traps; Escape dismisses when applicable; focus indicator is visible.
Screen reader (required — document steps below) — What to test for: Role and name are announced correctly; state changes (e.g. expanded, selected) are announced; labels and relationships are clear; no unnecessary or duplicate announcements.