Skip to content

Components: Replace Button busy stripes with a spinner - #85960

Closed
ciampo wants to merge 18 commits into
trunkfrom
codex/button-busy-spinner
Closed

ciampo wants to merge 18 commits into
trunkfrom
codex/button-busy-spinner

Conversation

@ciampo

@ciampo ciampo commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #85073 and the merged Button color updates in #86681, #86683, and #86684.

What?

Replace legacy Button busy stripes with a centered spinner.

Why?

Match the busy indicator used by @wordpress/ui while 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 loadingAnnouncement for customization or suppression. Callers continue to control disabling.

Button protects its internal spinner's visibility and layout with scoped !important styles. 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

  1. Run npm run storybook:e2e:dev and open Components → Button → Variant States. The isBusy rows should show centered spinners instead of stripes and labels.
  2. Open the Icon story. Check that busy icon buttons keep the same size as their resting state.
  3. Show Custom E2E Controls and use Raw props to toggle isBusy on a text or icon button. Its width and height should stay the same. Check primary busy buttons with both disabled and accessibleWhenDisabled; the spinner should remain readable.
  4. Check light and dark themes, reduced motion, and forced colors. The spinner should remain visible and its label hidden. With forced colors, disabled busy buttons should keep a full-strength spinner, and pressed buttons should keep a contrasting foreground and fill. Reduced motion should stop its rotation.
  5. Check a busy ToolbarButton, including a grouped button and a numbered button. Its spinner should stay centered.
  6. In the editor, enable Preferences → Accessibility → Show button text labels. Check header Undo/Redo, block alignment and justification, Add note, pinned sidebars, Styles, Patterns, and link controls. Their normal icons should hide where labels replace them, while busy indicators remain visible. Check any plugin-provided toolbar icons too.

Testing Instructions for Keyboard

  1. Tab to an enabled busy button and press Enter or Space. It should keep its accessible label and remain clickable.
  2. Move the pointer over the button, then away, and repeat keyboard activation. Its label should stay hidden and its spinner should remain visible.
  3. With a screen reader, trigger isBusy on an enabled, focused button. Hear 'Loading' once; the button should retain its name and focus. Set loadingAnnouncement to a custom message, then an empty string, and check the custom announcement and opt-out.

Screenshots or screencast

Primary Button with isBusy:

Trunk This PR
Trunk: primary busy Button with stripes and label This PR: primary busy Button with a centered spinner
Busy Button variants

Busy buttons only, in default, primary, secondary, tertiary, and link order:

Trunk This PR
Trunk: busy Button variants with stripes This PR: busy Button variants with centered spinners
Full Button state matrix
Trunk This PR
Trunk: full Button state matrix in the light theme This PR: full Button state matrix in the light theme
Busy buttons in the dark theme
Trunk This PR
Trunk: busy Button variants in the dark theme This PR: busy Button variants with spinners in the dark theme
Disabled loading indicators in forced colors

Native disabled primary buttons while loading, using browser-emulated forced colors:

Palette UI Button This PR
Light UI Button: disabled loading spinner in the light forced-colors palette This PR: disabled busy spinner with its label hidden in the light forced-colors palette
Dark UI Button: disabled loading spinner in the dark forced-colors palette This PR: disabled busy spinner with its label hidden in the dark forced-colors palette
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.

Context Trunk This PR
Editor header: button text labels Trunk: Editor header: button text labels This PR: Editor header: button text labels
Editor header: disabled actions Trunk: Editor header: disabled actions This PR: Editor header: disabled actions
Editor header: pressed action held down Trunk: Editor header: pressed action held down This PR: Editor header: pressed action held down
Pinned items: button text labels Trunk: Pinned items: button text labels This PR: Pinned items: button text labels
Editor Global Styles sidebar Trunk: Editor Global Styles sidebar This PR: Editor Global Styles sidebar
Site Editor Styles actions Trunk: Site Editor Styles actions This PR: Site Editor Styles actions
Site Editor Patterns actions Trunk: Site Editor Patterns actions This PR: Site Editor Patterns actions
Block toolbar: button text labels Trunk: Block toolbar: button text labels This PR: Block toolbar: button text labels
Parent block inserter: button text labels Trunk: Parent block inserter: button text labels This PR: Parent block inserter: button text labels
Link control: button text labels Trunk: Link control: button text labels This PR: Link control: button text labels
Rich Text format toolbar: button text labels Trunk: Rich Text format toolbar: button text labels This PR: Rich Text format toolbar: button text labels
Menus: trunk versus this PR

The last two rows focus the busy control with browser-emulated forced colors.

Context Trunk This PR
Disabled tertiary MenuItem Trunk: Disabled tertiary MenuItem This PR: Disabled tertiary MenuItem
Menu-choice icon spacing Trunk: Menu-choice icon spacing This PR: Menu-choice icon spacing
Focused busy MenuItem in forced colors Trunk: Focused busy MenuItem in forced colors This PR: Focused busy MenuItem in forced colors
Focused busy dropdown button in forced colors Trunk: Focused busy dropdown button in forced colors This PR: Focused busy dropdown button in forced colors
Save and publish controls: trunk versus this PR

Save-draft and saved-state captures remain visually identical after removing the redundant override.

Context Trunk This PR
Site Editor Save Hub Trunk: Site Editor Save Hub This PR: Site Editor Save Hub
Publish panel toggle Trunk: Publish panel toggle This PR: Publish panel toggle
Save draft: icon and text Trunk: Save draft: icon and text This PR: Save draft: icon and text
Post saved-state indicators Trunk: Post saved-state indicators This PR: Post saved-state indicators
Toolbars: trunk versus this PR

Each pair shows a non-busy icon button followed by its busy counterpart.

Context Trunk This PR
Toolbar icon buttons Trunk: Toolbar icon buttons This PR: Toolbar icon buttons
Grouped toolbar icon buttons Trunk: Grouped toolbar icon buttons This PR: Grouped toolbar icon buttons
Numbered toolbar icon buttons Trunk: Numbered toolbar icon buttons This PR: Numbered toolbar icon buttons
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 3f15c50f18d and PR code cd27afb1de8 at 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 trunk 976b1800b75 and PR d32970484d2 at 1100 × 800. The disabled forced-colors comparisons use PR fe26b1c1139 and 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.75 stroke, round ends, and label-based sizing for default, compact, and small buttons. Busy buttons keep their indicator colors when disabled, including when accessibleWhenDisabled keeps 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's ButtonText; 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 is 05b93025f32, based on trunk 3f15c50f18d. All 10 CI workflows passed for 05b93025f32.

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.

@github-actions github-actions Bot added the [Package] Components /packages/components label Oct 29, 2026
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground

🎉 Props

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: aduth <aduth@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: jasmussen <joen@git.wordpress.org>
Co-authored-by: jameskoster <jameskoster@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

📦 Bundle size

Size Change: +1.74 kB (+0.02%)

Total Size: 8.66 MB

📦 View Changed
Filename Size Change
build/scripts/components/index.min.js 338 kB +1.81 kB (+0.54%)
build/styles/components/style-rtl.css 18.2 kB +60 B (+0.33%)
build/styles/components/style-rtl.min.css 15.4 kB +130 B (+0.85%)
build/styles/components/style.css 18.2 kB +68 B (+0.37%)
build/styles/components/style.min.css 15.4 kB +139 B (+0.91%)
build/styles/edit-site/style-rtl.css 20.7 kB -26 B (-0.13%)
build/styles/edit-site/style-rtl.min.css 16.8 kB -27 B (-0.16%)
build/styles/edit-site/style.css 20.7 kB -25 B (-0.12%)
build/styles/edit-site/style.min.css 16.8 kB -27 B (-0.16%)
build/styles/editor/style-rtl.css 31.6 kB -93 B (-0.29%)
build/styles/editor/style-rtl.min.css 27.4 kB -86 B (-0.31%)
build/styles/editor/style.css 31.7 kB -91 B (-0.29%)
build/styles/editor/style.min.css 27.4 kB -88 B (-0.32%)

e461d79 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric 06d53d1 trunk % Change
timeToFirstByte 51.85 ms +5.21% -3.76% 51.5 ms +1.94% -3.69% 0.68%
largestContentfulPaint 84 ms +7.14% -4.76% 80 ms +0% -5% 5%
lcpMinusTtfb 33.75 ms +9.19% -12.15% 28.3 ms +2.83% -3.71% 19.26%
wpBeforeTemplate 25.98 ms +5.5% -3.62% 25.34 ms +1.89% -1.85% 2.53%
wpTemplate 21.35 ms +3.51% -4.03% 21.39 ms +5.05% -5.84% -0.19%
wpTotal 47.65 ms +5.75% -3.74% 47.06 ms +2.63% -2.74% 1.25%
wpMemoryUsage 7.75 MB +0% -0% 7.71 MB +0% -0% 0.45%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric 06d53d1 trunk % Change
timeToFirstByte 43.15 ms +2.67% -4.98% 41.2 ms +5.58% -2.55% 4.73%
largestContentfulPaint 80 ms +2.5% -5% 76 ms +0% -5.26% 5.26%
lcpMinusTtfb 36.1 ms +4.71% -1.11% 34.2 ms +4.39% -6.43% 5.56%
wpBeforeTemplate 22.33 ms +5.96% -3.09% 21.67 ms +1.75% -0.83% 3.05%
wpTemplate 16.81 ms +4.76% -6.42% 16.19 ms +3.4% -4.82% 3.83%
wpTotal 39.07 ms +3.53% -3.58% 37.79 ms +5.53% -1.91% 3.39%
wpMemoryUsage 6.44 MB +0% -0% 6.40 MB +0% -0% 0.56%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric 06d53d1 trunk % Change
mediaProcessingJpeg 406.02 ms +0.39% -0.55% 406.27 ms +0.66% -1.05% -0.06%
mediaProcessingAvif 5905.89 ms +0.36% -0.25% 5910.88 ms +0.43% -0.16% -0.08%
mediaProcessingJpegToAvif 4024.99 ms +0.62% -0.21% 4031.03 ms +0.13% -0.39% -0.15%

media-upload

Metric 06d53d1 trunk % Change
jpegUploadProcessing 1534.62 ms +32.77% -2.45% 1520.13 ms +1.4% -0.48% 0.95%
pngUploadProcessing 265.12 ms +1.52% -2.73% 271.39 ms +1.67% -2.17% -2.31%
largeJpegUploadProcessing 1509.53 ms +2.33% -0.63% 1785.4 ms +11.69% -15.26% -15.45%
multipleImageUploadProcessing 2077.55 ms +3.09% -5.17% 2043.93 ms +3.17% -18.82% 1.64%

post-editor

Metric 06d53d1 trunk % Change
serverResponse 420.51 ms +3.77% -8.35% 415.92 ms +2.34% -7.09% 1.1%
firstPaint 467.81 ms +6.21% -9.45% 406.01 ms +4.2% -3.36% 15.22%
domContentLoaded 831.35 ms +13.9% -1.91% 826.91 ms +1.01% -0.95% 0.54%
loaded 832.55 ms +13.85% -1.91% 828.03 ms +1.02% -0.97% 0.55%
firstContentfulPaint 473.08 ms +13.23% -1.51% 466.89 ms +0.34% -1.6% 1.33%
firstBlock 2157.17 ms +5.47% -0.69% 2113.04 ms +1.51% -0.88% 2.09%
type 19.55 ms +0.66% -12.79% 18.27 ms +7.77% -3.72% 7.01%
typeWithoutInspector 18.82 ms +5.84% -12.81% 18.68 ms +4.44% -12.21% 0.75%
typeWithTopToolbar 24.46 ms +4.62% -2.7% 24.15 ms +0.46% -4.68% 1.28%
typeContainer 8.84 ms +7.35% -13.12% 8.65 ms +6.01% -7.75% 2.2%
focus 121.1 ms +14.22% -3.22% 120.23 ms +5.83% -3.39% 0.72%
firstFocus 267.62 ms +0% -0% 259.02 ms +0% -0% 3.32%
selectAll 373.1 ms +3.29% -2.71% 335.05 ms +6.24% -0.88% 11.36%
undo 31.53 ms +5.58% -8.12% 31.87 ms +4.77% -8.85% -1.07%
listViewOpen 81.78 ms +5.62% -8.69% 76.01 ms +7.28% -9.14% 7.59%
inserterOpen 46.04 ms +3.43% -8.84% 42.54 ms +11.38% -6.39% 8.23%
inserterHover 12.35 ms +10.45% -9.15% 12.53 ms +5.11% -6.54% -1.44%
inserterSearch 9.68 ms +1.24% -13.95% 8.57 ms +10.04% -2.45% 12.95%
loadPatterns 724.9 ms +0.89% -4.76% 704.83 ms +2.95% -2.08% 2.85%
wpTotal 410.34 ms +3.84% -8.54% 406.05 ms +2.28% -7.38% 1.06%
wpMemoryUsage 14.81 MB +0% -0% 14.77 MB +0% -0% 0.25%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric 06d53d1 trunk % Change
serverResponse 304.88 ms +5.16% -6.9% 315.56 ms +6.2% -5.71% -3.38%
firstPaint 331.08 ms +12.92% -5.31% 384.9 ms +2.9% -19.02% -13.98%
domContentLoaded 662.55 ms +2.88% -0.61% 701.35 ms +1.78% -2.9% -5.53%
loaded 663.32 ms +2.88% -0.59% 702.37 ms +1.75% -2.91% -5.56%
firstContentfulPaint 370.78 ms +2.17% -2.07% 395.96 ms +4.31% -2.16% -6.36%
firstBlock 2020 ms +0.85% -0.27% 2129.42 ms +0.65% -1.67% -5.14%
type 16.38 ms +7.63% -7.51% 15.28 ms +8.7% -5.43% 7.2%
navigate 101.17 ms +4.79% -1.99% 104.19 ms +5% -4.53% -2.9%
loadPatterns 1197.34 ms +8.4% -14.9% 1165.65 ms +5.25% -9.52% 2.72%
loadPages 960.38 ms +5.21% -4.06% 999.65 ms +1.68% -6.46% -3.93%
wpTotal 296.56 ms +5.29% -7.09% 307.12 ms +6.34% -5.9% -3.44%
wpMemoryUsage 12.82 MB +0% -0% 12.79 MB +0% -0% 0.25%
wpDbQueries 45 +0% -0% 45 +0% -0% 0%

e461d79 Run

🏁 Flaky tests

Some 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 /test/e2e/specs/editor/blocks/query.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 22
+ Received  +  1

  Array [
    Object {
-     "innerBlocks": Array [
-       Object {
-         "innerBlocks": Array [
-           Object {
-             "name": "core/post-title",
-           },
-           Object {
-             "name": "core/post-featured-image",
-           },
-           Object {
-             "name": "core/post-excerpt",
-           },
-           Object {
-             "name": "core/separator",
-           },
-           Object {
-             "name": "core/post-date",
-           },
-         ],
-         "name": "core/post-template",
-       },
-     ],
+     "innerBlocks": Array [],
      "name": "core/query",
    },
  ]

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/query.spec.js:226:42
Undo restores the post selection when another synced entity is loaded (RTC WebSocket) in /test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 2
+ Received  + 2

  Object {
    "attributeKey": "content",
    "blockIndex": 0,
    "content": "abcdef",
-   "endOffset": 3,
-   "offset": 3,
+   "endOffset": 6,
+   "offset": 6,
  }

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts:363:5
does not select blocks in the canvas preview when editing from the sidebar (Site Editor v2) in /test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeFocused() failed

Locator: getByRole('combobox', { name: 'Search or type URL' })
Expected: focused
Timeout: 5000ms
Error: element(s) not found

Call log:
  - Expect "toBeFocused" getByRole('combobox', { name: 'Search or type URL' }) with timeout 5000ms
  - waiting for getByRole('combobox', { name: 'Search or type URL' })

    at LinkControl.useLinkControlSearch (/home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js:416:47)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js:179:21
should apply a named font size using the font size buttons in /test/e2e/specs/editor/various/font-size-picker.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 2
+ Received  + 2

- <!-- wp:paragraph {"fontSize":"large"} -->
+ <!-- wp:paragraph {"fontSize":"medium"} -->
- <p class="has-large-font-size">Paragraph to be made "large"</p>
+ <p class="has-medium-font-size">Paragraph to be made "large"</p>
  <!-- /wp:paragraph -->

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/font-size-picker.spec.js:153:6
should reset a named font size using input field in /test/e2e/specs/editor/various/font-size-picker.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 2
+ Received  + 2

- <!-- wp:paragraph {"fontSize":"small"} -->
+ <!-- wp:paragraph {"fontSize":"tiny"} -->
- <p class="has-small-font-size">Paragraph with font size reset using input field</p>
+ <p class="has-tiny-font-size">Paragraph with font size reset using input field</p>
  <!-- /wp:paragraph -->

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/font-size-picker.spec.js:216:6
should reset a named font size using the tools panel menu in /test/e2e/specs/editor/various/font-size-picker.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 2
+ Received  + 2

- <!-- wp:paragraph {"fontSize":"medium"} -->
+ <!-- wp:paragraph {"fontSize":"small"} -->
- <p class="has-medium-font-size">Paragraph with font size reset using tools panel menu</p>
+ <p class="has-small-font-size">Paragraph with font size reset using tools panel menu</p>
  <!-- /wp:paragraph -->

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/font-size-picker.spec.js:178:6

e461d79 Run

@ciampo ciampo self-assigned this Nov 13, 2026
@ciampo
ciampo force-pushed the codex/button-busy-spinner branch from 35eabef to 9fc87d0 Compare November 13, 2026 15:47
@ciampo ciampo added the [Type] Enhancement A suggestion for improvement. label Nov 13, 2026
@github-actions github-actions Bot added the [Package] Edit Post /packages/edit-post label Nov 13, 2026
@ciampo
ciampo marked this pull request as ready for review November 14, 2026 08:47
@ciampo
ciampo requested a review from a team as a code owner November 14, 2026 08:47
@github-actions
github-actions Bot requested a review from aduth November 14, 2026 08:48
@ciampo
ciampo requested a review from a team November 14, 2026 08:54
@github-actions github-actions Bot added [Package] Editor /packages/editor [Package] Block editor /packages/block-editor [Package] Edit Site /packages/edit-site labels Nov 14, 2026
@ciampo
ciampo force-pushed the codex/button-busy-spinner branch from ffd9030 to b7ee52e Compare November 14, 2026 11:10
@github-actions github-actions Bot removed the [Package] Block editor /packages/block-editor label Nov 14, 2026
@ciampo
ciampo requested a review from fabiankaegy as a code owner November 14, 2026 15:22
@github-actions github-actions Bot added [Package] Block library /packages/block-library [Package] Block editor /packages/block-editor [Package] Interface /packages/interface labels Nov 14, 2026
@jasmussen

Copy link
Copy Markdown
Contributor

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.

@ciampo

ciampo commented Nov 16, 2026

Copy link
Copy Markdown
Contributor Author

Some additional context: this PR basically tries to align @wordpress/components's Button with the @wordpress/ui's Button, both visually (spinner instead of animated striped bg) and behaviourally (Button now causes screen readers to announce "loading", and the message can be customized). In that sense, the a11y pattern used here should be "safe", since we're using it in @wordpress/ui, too.

This is mostly to improve consistency between the two packages, as we plan on migrating soon from components to ui Button

Comment on lines +127 to +129
// Hide the button icons when labels are set to display...
svg {
svg[data-wp-editor-icon],
[data-wp-editor-icon] svg {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ciampo
ciampo force-pushed the codex/button-busy-spinner branch from 2b31ba6 to 6a7747f Compare November 16, 2026 17:18
@github-actions github-actions Bot removed [Package] Block library /packages/block-library [Package] Interface /packages/interface labels Nov 16, 2026
@github-actions github-actions Bot removed the [Package] Block editor /packages/block-editor label Nov 16, 2026
@ciampo
ciampo requested a review from aduth November 16, 2026 17:35

@mirka mirka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@jameskoster

Copy link
Copy Markdown
Contributor

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 small variants currently have different font sizes.

@ciampo

ciampo commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

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.

I noticed the small variants currently have different font sizes.

That will be done separately in #79993 (working on it now)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Components /packages/components [Package] Edit Post /packages/edit-post [Package] Edit Site /packages/edit-site [Package] Editor /packages/editor [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants