You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Switch component is not visible or barely visible in Windows High Contrast Mode (WHCM) because its appearance depends on CSS background-color. High contrast themes remove or override background colors for accessibility, so the switch track and thumb lose their visual distinction and the control can appear invisible or indistinguishable from the page.
To Reproduce
Open an app or Storybook that renders the Canvas Kit Switch component.
On Windows, enable a High Contrast theme: Settings → Accessibility → Contrast themes (or Settings → Ease of Access → High contrast on older Windows), then choose a theme (e.g. "High Contrast Add .travis.yml #1").
Or use the High Contrast mode in browser DevTools (e.g. Chrome: Rendering → Emulate CSS media feature prefers-contrast or forced-colors).
Observe the Switch in both unchecked and checked states.
Expected Behavior
The Switch should remain clearly visible and understandable in High Contrast Mode. Users should be able to see:
The track (background) of the switch.
The thumb (circle) and its position (on vs off).
Focus and error/caution states.
This can be achieved by using techniques that work when backgrounds are stripped, such as visible borders, outlines, or forced-colors / prefers-contrast media queries, while still respecting the user’s high contrast theme.
Actual Results
In Windows High Contrast Mode (or when emulating it):
The track relies on backgroundColor: system.color.bg.muted.soft (and brand.primary.base when checked) and can disappear or blend into the page when backgrounds are overridden.
The thumb relies on backgroundColor: brand.primary.accent and can also become invisible or indistinguishable.
The switch may look like an empty area or a single flat color, making it unclear that it’s a control and whether it’s on or off.
Screenshot:
Relevant code: the track and thumb are styled in modules/react/switch/lib/Switch.tsx (e.g. switchBackgroundStencil and switchCircleStencil) using backgroundColor for the main visual states.
Browser (if applicable)
Reproducible in any browser on Windows when a system High Contrast theme is active. Can also be verified by emulating forced-colors: active or prefers-contrast: high in Chrome/Edge DevTools.
Use high-contrast–friendly styling so the switch remains visible when backgrounds are removed:
Borders: Add a visible border (e.g. 1–2px solid) on the track and/or thumb so the shape is still clear in WHCM.
Forced Colors: Use @media (forced-colors: active) (and -ms-high-contrast for older Edge) to set border and, if needed, outline or other properties that are preserved in high contrast, and avoid relying solely on background-color for the main visual distinction.
System colors (optional): Consider Canvas / ButtonFace or similar for borders in forced-colors mode so the control respects the user’s high contrast palette.
🐛 Bug Report
The Switch component is not visible or barely visible in Windows High Contrast Mode (WHCM) because its appearance depends on CSS
background-color. High contrast themes remove or override background colors for accessibility, so the switch track and thumb lose their visual distinction and the control can appear invisible or indistinguishable from the page.To Reproduce
Expected Behavior
The Switch should remain clearly visible and understandable in High Contrast Mode. Users should be able to see:
This can be achieved by using techniques that work when backgrounds are stripped, such as visible borders, outlines, or
forced-colors/prefers-contrastmedia queries, while still respecting the user’s high contrast theme.Actual Results
In Windows High Contrast Mode (or when emulating it):
backgroundColor: system.color.bg.muted.soft(andbrand.primary.basewhen checked) and can disappear or blend into the page when backgrounds are overridden.backgroundColor: brand.primary.accentand can also become invisible or indistinguishable.Screenshot:
Relevant code: the track and thumb are styled in
modules/react/switch/lib/Switch.tsx(e.g.switchBackgroundStencilandswitchCircleStencil) usingbackgroundColorfor the main visual states.Browser (if applicable)
Reproducible in any browser on Windows when a system High Contrast theme is active. Can also be verified by emulating
forced-colors: activeorprefers-contrast: highin Chrome/Edge DevTools.Link to repl or repo (highly encouraged)
modules/react/switch/lib/Switch.tsxmodules/react/switch/stories/(e.g. Basic, Disabled, Error)Suggested direction for a fix
Use high-contrast–friendly styling so the switch remains visible when backgrounds are removed:
border(e.g. 1–2px solid) on the track and/or thumb so the shape is still clear in WHCM.@media (forced-colors: active)(and-ms-high-contrastfor older Edge) to setborderand, if needed,outlineor other properties that are preserved in high contrast, and avoid relying solely onbackground-colorfor the main visual distinction.Canvas/ButtonFaceor similar for borders in forced-colors mode so the control respects the user’s high contrast palette.References: MDN – forced-colors, Styling for Windows High Contrast.