Skip to content

Switch, FormToggle: Keep disabled checked switches looking on - #86260

Closed
yaman-694 wants to merge 2 commits into
WordPress:trunkfrom
yaman-694:fix/disabled-switch-checked-contrast
Closed

yaman-694 wants to merge 2 commits into
WordPress:trunkfrom
yaman-694:fix/disabled-switch-checked-contrast

Conversation

@yaman-694

@yaman-694 yaman-694 commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

What?

Closes #86259

A disabled switch that is on now has a medium gray track and a light thumb, in both the @wordpress/ui Switch and the @wordpress/components FormToggle, so it no longer looks like a disabled switch that is off.

Why?

Since #83773, a disabled and checked switch has a very light gray track (#e6e6e6) with a gray thumb (#8d8d8d). Next to a disabled unchecked switch (transparent track, gray thumb), only the thumb position tells them apart, so "on" reads as "off". The issue shows this in WooPayments onboarding, where the always-on "Credit/debit card" method looks turned off.

Checkboxes and radios keep their check mark or dot when disabled. A switch shows its state through color and shape, so once the color goes gray, the shape has to carry the state.

How?

For the disabled and checked state only:

  • Track: --wpds-color-stroke-interactive-neutral (#8d8d8d) instead of --wpds-color-background-interactive-brand-strong-disabled.
  • Thumb: --wpds-color-foreground-interactive-brand-strong (#eff0f2), the same as the enabled checked thumb, instead of --wpds-color-foreground-interactive-brand-strong-disabled. In Switch, the checked thumb rule already sets this, so the disabled override is removed and only its forced-colors branch remains.

This keeps the enabled "on" shape (filled track, light thumb) in gray, which is the June 2026 look the issue proposes. The disabled unchecked state and forced-colors mode are unchanged.

Token choice

This PR reuses existing tokens and does not add any, so the public token contract does not change. The issue asks which tokens the design system prefers, so this is open to feedback:

  • brand-strong-disabled cannot simply be darkened, since the disabled primary Button uses it too.
  • stroke-interactive-neutral is a stroke token used as a fill. This matches what the switch used in June. If a dedicated background token is preferred, I can add one pointing to the same ramp step (bg.stroke3) in this PR.
  • The thumb uses foreground-interactive-brand-strong (#eff0f2) instead of pure white, since there is no white foreground token.

Dark mode is not covered, since there are no dark color tokens yet.

Testing Instructions

  1. Run npm run storybook:dev.
  2. Open Design System/Components/Form/Primitives/Switch and compare the Checked, Disabled and Disabled Checked stories. Disabled Checked should have a medium gray track with a light thumb on the right.
  3. Open Components/@wordpress-components/Deprecated/FormToggle, set disabled in Controls, and check the same look.
  4. Turn on forced colors (for example, Chrome DevTools > Rendering > Emulate CSS forced-colors) and check that the disabled checked switch still shows a visible thumb on a GrayText track.

Testing Instructions for Keyboard

This changes colors only. Tab through the enabled Switch and FormToggle stories and check that focus and toggling with Space still work, and that disabled switches are still skipped.

Screenshots or screencast

compare

Use of AI Tools

I used Claude Code (Claude Opus 5.5) for this PR. It helped trace the regression to #83773, choose existing tokens that match the proposal in the issue, write the CSS changes, check the before and after colors in Storybook (including forced colors mode), and draft this description. I reviewed the changes and take responsibility for them.

@github-actions github-actions Bot added [Package] Components /packages/components [Package] UI /packages/ui labels Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground Preview in Storybook

👋 Welcome

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @yaman-694! In case you missed it, we'd love to have you join us in our Slack community.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

🏷️ Labels

This pull request needs exactly one label indicating its type, and has 0.

  • Required: any label starting with [Type].
  • Found: none.

Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you.

@github-actions github-actions Bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Nov 3, 2026
A disabled checked switch had a very light gray track with a gray
thumb, so next to a disabled unchecked switch only the thumb position
told them apart. Use a medium gray track with the light checked thumb,
which keeps the enabled "on" shape in gray.

Closes WordPress#86259.
@yaman-694
yaman-694 force-pushed the fix/disabled-switch-checked-contrast branch from db285cb to 62970fb Compare November 3, 2026 16:01
@yaman-694

Copy link
Copy Markdown
Contributor Author

Closing in favor of #86262, which has the same changes.

@yaman-694 yaman-694 closed this Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Package] Components /packages/components [Package] UI /packages/ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disabled switch: "on" looks like "off" since #83773

1 participant