Repository navigation
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: +1.74 kB (+0.02%) Total Size: 8.66 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. List in
|
35eabef to
9fc87d0
Compare
ffd9030 to
b7ee52e
Compare
|
Not feeling strongly about this, design-wise it works for me. I think it might need an accessibility gut-check. My read is: this makes sense insofar as you invoke an action, and something changes—that's good. But that's the part to double-check. |
|
Some additional context: this PR basically tries to align This is mostly to improve consistency between the two packages, as we plan on migrating soon from components to ui |
| // Hide the button icons when labels are set to display... | ||
| svg { | ||
| svg[data-wp-editor-icon], | ||
| [data-wp-editor-icon] svg { |
There was a problem hiding this comment.
Am I following that this change and the renderActionIcon stuff is largely to do with the "Show button text labels" accessibility option and making sure that the loading state's spinner isn't hidden without an alternative text?
If so:
- If someone configures "Show button text labels", wouldn't they not want to see the spinner and see a text label instead?
- How well does this approach handle toolbar icons added by third-party plugins?
- Would it be safer to handle this as an opt-out, where we could annotate a
data-attribute on the specific elements we don't want to be hidden?
I'm not a huge fan of how "magical" this existing implementation of "Show button text labels" is meant to be and would love for it to be a bit more controlled (I think we talked about a theme context at one point, for example), but it feels like a risky area to be flipping the logic so substantially here, at least without some thorough regression coverage.
There was a problem hiding this comment.
The class and selector changes were there to keep the existing broad svg selectors from also hiding or restyling the new spinner. The intent was to exempt the spinner while keeping action-icon styling consumer-owned.
I have now pushed new changes in which I've protected the spinner's styles inside Button with !important and restored the original consumer selectors. That preserves the existing handling of third-party icons without making consumers aware of Button's internal spinner.
I think showing "Loading" text when "Show button text labels" is enabled should be considered separately. Changing the busy presentation for that preference could affect button sizing and toolbar wrapping in the editor, so I'd keep this PR focused on aligning the busy indicator with UI Button. For now, the spinner stays visible, the original label still reserves its space and remains the accessible name, and loading is announced politely.
The new browser tests cover unannotated plugin icons and busy feedback across nine editor contexts, including unchanged button dimensions and spinner centering and size under grouped and numbered toolbar styles.
2b31ba6 to
6a7747f
Compare
mirka
left a comment
There was a problem hiding this comment.
Personally, I don't think this level of consistency is necessary for marking the new Button as ready. Needing so many CSS changes in other packages to compensate for this is already a sign that this will break consumer usage. Different button loading styles aren't important enough to justify this broad of a change IMO.
Maybe we should take a step back and align on what the consistency requirements are here. What else is left that's truly a big enough problem to further delay the recommendation of new Button? Or at least just start the maintainer-led initial migrations?
|
Good thought. As long as there's no glaringly obvious difference between the buttons at rest in terms of colors, size, text formatting, etc., maybe that's okay? On that note, I noticed the |
|
I'm personally ok to drop these changes if we feel like the compromise "consistency" vs "complexity and potential for regression" is not worth it. I agree with you, although I was making those changes based on feedback received in the past pushing for the higher consistency possible between components and ui packages.
That will be done separately in #79993 (working on it now) |
Follow-up to #85073 and the merged Button color updates in #86681, #86683, and #86684.
What?
Replace legacy
Buttonbusy stripes with a centered spinner.Why?
Match the busy indicator used by
@wordpress/uiwhile keeping the button's dimensions stable.How?
Render a decorative Spinner over the existing content to preserve the button's dimensions and accessible name. Announce 'Loading' through a polite live region, with
loadingAnnouncementfor customization or suppression. Callers continue to control disabling.Button protects its internal spinner's visibility and layout with scoped
!importantstyles. Existing consumer SVG selectors stay unchanged, including those used by Show button text labels, so third-party action icons need no changes. Busy buttons continue to show the spinner when text labels are enabled.Testing Instructions
npm run storybook:e2e:devand open Components → Button → Variant States. TheisBusyrows should show centered spinners instead of stripes and labels.isBusyon a text or icon button. Its width and height should stay the same. Check primary busy buttons with bothdisabledandaccessibleWhenDisabled; the spinner should remain readable.ToolbarButton, including a grouped button and a numbered button. Its spinner should stay centered.Testing Instructions for Keyboard
isBusyon an enabled, focused button. Hear 'Loading' once; the button should retain its name and focus. SetloadingAnnouncementto a custom message, then an empty string, and check the custom announcement and opt-out.Screenshots or screencast
Primary Button with
isBusy:Busy Button variants
Busy buttons only, in default, primary, secondary, tertiary, and link order:
Full Button state matrix
Busy buttons in the dark theme
Disabled loading indicators in forced colors
Native disabled primary buttons while loading, using browser-emulated forced colors:
Button text labels: trunk versus this PR
Matching isolated fixtures use real components and built production consumer styles. These are not full-editor screenshots. Controls show non-busy then busy states. The disabled header fixture includes both primary and pressed tertiary pairs.
Menus: trunk versus this PR
The last two rows focus the busy control with browser-emulated forced colors.
Save and publish controls: trunk versus this PR
Save-draft and saved-state captures remain visually identical after removing the redundant override.
Toolbars: trunk versus this PR
Each pair shows a non-busy icon button followed by its busy counterpart.
Earlier capture and verification details
These captures predate the latest change that protects spinner styles inside Button. The three private icon helpers mentioned below have been removed.
The primary, busy-variant, and consumer comparisons use trunk
3f15c50f18dand PR codecd27afb1de8at a 1100 × 900 viewport. All 23 contexts cover the 18 stylesheets changed by this PR and the affected consumer integrations. The full state matrix and dark-theme comparisons use trunk976b1800b75and PRd32970484d2at 1100 × 800. The disabled forced-colors comparisons use PRfe26b1c1139and UI Button from the same checkout at 1100 × 800. All captures use 2× pixel density and reduced motion to hold the indicators still.The production build, type checking, lint checks, and all 59 Button tests passed locally. The four new tests cover accessible names and loading announcements. Appearance is verified through browser checks and comparison captures. Browser comparison with UI Button confirmed the same
2.75stroke, round ends, and label-based sizing for default, compact, and small buttons. Busy buttons keep their indicator colors when disabled, including whenaccessibleWhenDisabledkeeps them focusable. Forced-colors checks cover both disabling methods and buttons rendered as links in light and dark palettes. The label remains hidden in forced colors. Unpressed spinners match UI Button'sButtonText; pressed spinners retain their paired system foreground and fill. The browser accessibility tree retains button names and descriptions while the label is visually hidden. Tests cover loading announcements and their customization and suppression. VoiceOver was checked with a human listener. 'Loading' was announced once, and the focused button kept its 'Save changes' name. Browser checks also covered 360 busy controls across nine consumer contexts, all five variants, enabled and focusable disabled states, light/dark themes, and forced colors. The override cleanup preserves button dimensions. Independent review found no remaining actionable findings. Checks of 48 real core controls and icon cases also cover collapsed and expanded alignment and justification controls, Undo/Redo, Add note, block icons, heading icons, matrix icons, and all three private package helpers. They verify icon hiding, busy indicators, custom sizing, intrinsic SVG styles, and unchanged Dashicon sizing. The verified head is05b93025f32, based on trunk3f15c50f18d. All 10 CI workflows passed for05b93025f32.Verification at e461d79
Build, full type checking, JavaScript and CSS lint, and all 82 focused tests passed locally.
The 18 browser regression tests use real Button and consumer styles across nine editor contexts. They check that unannotated plugin icons hide when button text labels are enabled, while busy feedback remains visible. They also check unchanged accessible names, polite loading announcements, and unchanged button width and height. The toolbar fixture includes grouped and numbered button styles, and the busy checks verify spinner centering and size.
With the original consumer selectors restored, all nine busy-feedback checks failed before Button's spinner styles were protected.
Use of AI Tools
Codex implemented the extraction, tests, documentation, rebase, and browser captures. Independent local agents reviewed the changes.