Repository navigation
Conversation
🤖 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. 🏷️ 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. |
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
force-pushed
the
fix/disabled-switch-checked-contrast
branch
from
November 3, 2026 16:01
db285cb to
62970fb
Compare
Contributor
Author
|
Closing in favor of #86262, which has the same changes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.