Repository navigation
Components: Align Button colors with the UI package - #85073
jameskoster wants to merge 16 commits into
Conversation
🤖 PR meta 🤖🎉 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 📦 Bundle sizeSize Change: +2.19 kB (+0.03%) Total Size: 8.63 MB 📦 View Changed
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. Page List converts to Navigation Links with entity bindings in
|
Only a busy button is a positioning parent, so a click on a dataform field row still opens the flyout. Drop the lint disables that recommending Button made unused. Co-authored-by: Cursor <cursoragent@cursor.com>
Match the 24px canvas and list view appenders to the button minimum height, and drop the changelog note for the hit area that already works on trunk. Co-authored-by: Cursor <cursoragent@cursor.com>
5297c07 to
2d27402
Compare
|
Thank you, Jay ! Given that visually things look good, let's wait for a code-focused review, too. |
|
I still feel misaligned with the overall scope/ambition/risk profile of this PR, and it's making it hard to greenlight for me. It's pretty big even with just the Button changes, so I'm not sure why it's mixed together with changes in so many other components. I may be missing something but it doesn't seem to need to land together. I also don't quite understand why we're not going with the smallest possible change in the Button stylesheet. It seems like it could be just a token value swap, but it's actually changing a lot of structure and specificity, which increases the breakage surface. Is that restructuring intended, and worth it at this point? If it is intended, could it be broken down further into smaller changesets with justification? It feels like a departure from the usual caution we've exercised for this component. (A quick local test with a simple token swap strategy seemed fine by the way.) |
I haven't experimented in details, but we can probably preserve more of the existing selectors and order. My aim was to use the matching WPDS foreground, background, and border tokens across states, including in dark and custom themes. That needs mapping at each declaration, since the legacy accent variable serves several roles, and destructive buttons currently override it locally. But that doesn't mean all the selector restructuring needs to come with it. A "safer" iteration would be to keep the existing structure wherever possible and justify any remaining selector changes with specific failing cases, such as keyboard activation or busy stripes disappearing.
Some of the surrounding changes are coupled to Button's pressed colors. Toolbar paints its own pressed background, and the headers override that background again. Those need to stay paired with Button's foreground changes, but they could form a separate PR together. Maybe we could split this PR into three smaller parts:
WDYT ? |
|
Not sure how many PRs total, but I think the first pass would be really easy to land if it were only value changes with no specificity/selector changes. We can get pretty far with just that, right? |
|
Sure, we can get a useful first pass with value changes only. Most ordinary states already declare fg and bg together, so using matching WPDS tokens doesn't itself require changing selectors. As mentioned above, the main caveat is destructive buttons: they override the shared accent variable to red. Replacing its uses with brand tokens would bypass those overrides, so we'd need to preserve that mechanism or leave the affected declarations for a later pass. I'd also keep the pressed-state changes together with Toolbar and the header overrides, since those paint their own backgrounds and need to match Button's foreground. That group can be deferred. Those state-by-state mappings will still be needed to align with UI Button and follow the theme with accessible text contrast, including in dark and custom themes. I'm happy to split that work into smaller PRs. That doesn't mean every selector change in this PR is necessary; any that remain should be justified by a specific failing case, such as keyboard activation. I'll proceed to implement those changes across a series of PRs so that you can take a look and validate the split |
Follows merged #85939. Busy-spinner work remains in #85960. Related to #84573 and #76135.
What?
Align legacy
Buttoncolors with the semantic colors used by@wordpress/ui.Why?
Use the same theme-aware colors without changing button sizing, wrapping, typography, or busy presentation.
How?
Use WPDS semantic tokens and their generated fallbacks for Button colors. Update grouped, toolbar, and header overrides to keep their state colors consistent. Preserve disabled primary header fills in light and dark themes, and system-color fills in forced colors mode. Keep busy stripes visible during pointer and keyboard activation.
Color customization changes: With the token stylesheet loaded, WPDS colors take precedence over admin color schemes and legacy
--wp-components-color-*overrides. Without the tokens, generated fallbacks follow the admin color scheme. UseThemeProviderto customize the WPDS palette.Testing Instructions
npm run storybook:e2e:devand open the Button "Variant States" story. Check light, dark, and a custom orange primary color. Enabled labels should remain readable, including against both busy stripes.ThemeProvider, compare Button with and without the WPDS token stylesheet. WPDS colors win when loaded; the selected admin scheme supplies the generated fallback when tokens are absent.Testing Instructions for Keyboard
Screenshots or screencast
Latest trunk at capture time,
e85ab418c68, compared with this PR ata403e34c1c5. Each pair uses matching props, viewport, theme, and reduced-motion settings.Detailed Button states
Space captures hold Space with the pointer away from the button. Hover captures place the pointer over the button.
Header compositions in the dark theme
These isolated compositions use production Button, Toolbar, and header styles. Each header shows an enabled and a disabled pressed primary control.
Use of AI Tools
This PR was implemented with Cursor. I reviewed the styling, recommendation metadata, and tests, and I am responsible for the change.
The rebase, color-only rescope, and follow-up fixes used Codex and independent local agent reviews.