Repository navigation
Conversation
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.
🤖 PR meta 🤖👋 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. 🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the 🏷️ LabelsThis pull request needs exactly one label indicating its type, and has 0.
Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you. |
|
Let's agree on #86259 first, before making further code changes and reviewing |
|
Closing in favour of #86678 |
What?
Closes #86259
A disabled switch that is on now has a medium gray track and a light thumb, in both the
@wordpress/uiSwitchand the@wordpress/componentsFormToggle, 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:
--wpds-color-stroke-interactive-neutral(#8d8d8d) instead of--wpds-color-background-interactive-brand-strong-disabled.--wpds-color-foreground-interactive-brand-strong(#eff0f2), the same as the enabled checked thumb, instead of--wpds-color-foreground-interactive-brand-strong-disabled. InSwitch, 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-disabledcannot simply be darkened, since the disabled primaryButtonuses it too.stroke-interactive-neutralis 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.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
npm run storybook:dev.Design System/Components/Form/Primitives/Switchand compare theChecked,DisabledandDisabled Checkedstories.Disabled Checkedshould have a medium gray track with a light thumb on the right.Components/@wordpress-components/Deprecated/FormToggle, setdisabledin Controls, and check the same look.GrayTexttrack.Testing Instructions for Keyboard
This changes colors only. Tab through the enabled
SwitchandFormTogglestories and check that focus and toggling with Space still work, and that disabled switches are still skipped.Screenshots or screencast
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.