Skip to content

Widgets: Use UI Menu for moving widgets between areas - #82966

Open
ciampo wants to merge 3 commits into
trunkfrom
codex/widgets-move-area-ui-menu
Open

ciampo wants to merge 3 commits into
trunkfrom
codex/widgets-move-area-ui-menu

Conversation

@ciampo

@ciampo ciampo commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Part of #61094.

What?

Use @wordpress/ui Menu for Move to widget area in both widget editors.

Why?

One shared migration updates the Widgets screen and Customizer.

How?

Keep the public props and toolbar integration. Preserve area descriptions, the selected area, and the no-op behavior when selecting the current area. Add the package's direct UI dependency. Exclude menu focus guards from toolbar control detection, and keep Customizer selection when interacting with UI overlays.

Testing Instructions

With a classic theme that has two widget areas, add a Paragraph to the first area. Open Move to widget area in its toolbar and choose the second area. Verify the paragraph moves. Repeat in the Customizer. Selecting the current area should leave the widget and menu in place.

Testing Instructions for Keyboard

Focus the move trigger through the block toolbar. Open it with Enter, navigate with arrow keys, and select a destination. Escape should close the menu and return focus to its toolbar trigger.

Screenshots

Before After
Screenshot 2026-09-28 at 16 11 23 Screenshot 2026-09-28 at 16 13 23
Screenshot 2026-09-28 at 16 12 00 Screenshot 2026-09-28 at 16 12 41

Use of AI Tools

Implemented and verified with OpenAI Codex.

@github-actions

github-actions Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

🎉 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: jameskoster <jameskoster@git.wordpress.org>
Co-authored-by: jasmussen <joen@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>

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

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

📦 Bundle size

Size Change: +68.2 kB (+0.83%)

Total Size: 8.3 MB

📦 View Changed
Filename Size Change
build/scripts/block-editor/index.min.js 515 kB +26 B (+0.01%)
build/scripts/customize-widgets/index.min.js 59.3 kB +17 B (+0.03%)
build/scripts/widgets/index.min.js 75.6 kB +68.1 kB (+910.99%) 🆘

5ad9600 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric df61772 trunk % Change
timeToFirstByte 59.25 ms +11.73% -4.56% 60.05 ms +11.66% -4.08% -1.33%
largestContentfulPaint 100 ms +2% -6% 98 ms +8.16% -6.12% 2.04%
lcpMinusTtfb 36.3 ms +17.77% -4.27% 34.6 ms +5.64% -1.3% 4.91%
wpBeforeTemplate 29.9 ms +13.51% -4.92% 28.89 ms +22.6% -1.63% 3.5%
wpTemplate 25.06 ms +6.07% -2.11% 25.78 ms +6.21% -2.29% -2.79%
wpTotal 55.41 ms +10.34% -4.64% 56.25 ms +11.11% -4.28% -1.49%
wpMemoryUsage 7.61 MB +0% -0% 7.57 MB +0% -0% 0.51%
wpDbQueries 17 +0% -0% 17 +0% -0% 0%

front-end-classic-theme

Metric df61772 trunk % Change
timeToFirstByte 47.75 ms +7.85% -1.68% 47.75 ms +9.53% -1.15% 0%
largestContentfulPaint 104 ms +3.85% -0% 104 ms +3.85% -3.85% 0%
lcpMinusTtfb 56.45 ms +1.15% -2.48% 55.7 ms +1.89% -4.58% 1.35%
wpBeforeTemplate 26.37 ms +6.56% -2.31% 26.38 ms +2.99% -1.18% -0.04%
wpTemplate 18.08 ms +6.58% -1.38% 18.27 ms +3.72% -2.57% -1.04%
wpTotal 44.66 ms +7.41% -1.88% 44.69 ms +9.44% -1.25% -0.07%
wpMemoryUsage 6.22 MB +0% -0% 6.19 MB +0% -0% 0.58%
wpDbQueries 14 +0% -0% 14 +0% -0% 0%

media-processing

Metric df61772 trunk % Change
mediaProcessingJpeg 404.04 ms +2.61% -1.33% 398.99 ms +0.89% -0.28% 1.27%
mediaProcessingAvif 6069.31 ms +0.23% -0.12% 6062.12 ms +0.33% -0.08% 0.12%
mediaProcessingJpegToAvif 4191.94 ms +0.17% -0.32% 4192.44 ms +0.48% -0.24% -0.01%

media-upload

Metric df61772 trunk % Change
jpegUploadProcessing 1464.32 ms +32.94% -1.82% 1431.5 ms +0.8% -0.59% 2.29%
pngUploadProcessing 182.69 ms +3.46% -2.15% 230.4 ms +2.5% -17.78% -20.71%
largeJpegUploadProcessing 1409.33 ms +1.8% -0.71% 1424.66 ms +0.38% -0.8% -1.08%
multipleImageUploadProcessing 1554.14 ms +1.97% -0.18% 1615.78 ms +0.49% -1.04% -3.81%

post-editor

Metric df61772 trunk % Change
serverResponse 395.07 ms +9.17% -2.57% 440.21 ms +1.12% -10.42% -10.25%
firstPaint 223.72 ms +12.41% -10.74% 228.49 ms +12.33% -13.94% -2.09%
domContentLoaded 1109.04 ms +0.8% -0.54% 1074.17 ms +1.09% -2.13% 3.25%
loaded 1110.33 ms +0.81% -0.52% 1075.64 ms +1.06% -2.14% 3.23%
firstContentfulPaint 472.05 ms +2.68% -3.37% 434.51 ms +4.44% -5.74% 8.64%
firstBlock 3206.46 ms +0.6% -0.53% 3154.18 ms +1.18% -0.98% 1.66%
type 20.25 ms +3.75% -3.16% 19.83 ms +7.16% -5.5% 2.12%
typeWithoutInspector 18.91 ms +7.4% -4.97% 18.72 ms +6.52% -4.27% 1.01%
typeWithTopToolbar 25.03 ms +14.86% -1.32% 24.14 ms +9.24% -3.65% 3.69%
typeContainer 1.29 ms +12.4% -38.76% 1.25 ms +17.6% -35.2% 3.2%
focus 14.11 ms +1.91% -10.35% 14.41 ms +21.1% -9.16% -2.08%
firstFocus 27.95 ms +0% -0% 31.52 ms +0% -0% -11.33%
selectAll 1510.87 ms +2.6% -0.61% 1468.62 ms +0.68% -0.54% 2.88%
listViewOpen 63.11 ms +3.38% -9.98% 61.18 ms +7.08% -9.01% 3.15%
inserterOpen 23.51 ms +23.56% -2.21% 24.72 ms +6.84% -9.22% -4.89%
inserterHover 2.52 ms +12.7% -15.48% 2.35 ms +4.68% -9.79% 7.23%
inserterSearch 8.41 ms +6.42% -2.02% 8.57 ms +6.65% -7.47% -1.87%
loadPatterns 684.48 ms +1.55% -2.18% 684.36 ms +2.67% -6.26% 0.02%
wpTotal 383.46 ms +9.12% -2.57% 428.57 ms +1.35% -10.66% -10.53%
wpMemoryUsage 13.14 MB +0% -0% 13.11 MB +0% -0% 0.28%
wpDbQueries 54 +0% -0% 54 +0% -1.85% 0%

site-editor

Metric df61772 trunk % Change
serverResponse 488.84 ms +4.87% -2.3% 500.81 ms +5.78% -3.01% -2.39%
firstPaint 250.71 ms +18.66% -7.56% 242.91 ms +32.39% -6.54% 3.21%
domContentLoaded 1210.7 ms +1.26% -2.1% 1163.13 ms +0.87% -0.82% 4.09%
loaded 1212.05 ms +1.25% -2.09% 1164.46 ms +0.86% -0.82% 4.09%
firstContentfulPaint 477.42 ms +2.09% -0.54% 448.03 ms +2.18% -2.17% 6.56%
firstBlock 4368.47 ms +0.93% -1.3% 4258.73 ms +0.75% -0.16% 2.58%
type 19.76 ms +1.72% -2.94% 18.06 ms +3.21% -3.16% 9.41%
navigate 108.35 ms +19.1% -3.16% 105.53 ms +15.34% -4.53% 2.67%
loadPatterns 1319.02 ms +20.12% -5.19% 1302.17 ms +9.46% -5.59% 1.29%
loadPages 1078.4 ms +1.42% -0.44% 1069 ms +4.49% -0.25% 0.88%
wpTotal 479.25 ms +4.91% -2.35% 491.12 ms +5.75% -3.23% -2.42%
wpMemoryUsage 12.11 MB +0% -0% 12.09 MB +0% -0% 0.13%
wpDbQueries 43 +2.33% -0% 43.5 +1.15% -1.15% -1.15%

5ad9600 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.

should cut and paste individual blocks with collapsed selection in /test/e2e/specs/editor/various/copy-cut-paste.spec.js, passed after 1 failed attempt.
Error: expect(string).toMatchSnapshot(expected) failed

  @@ -1,3 +1,3 @@
   <!-- wp:paragraph -->
  -<p>2Cut - collapsed selection</p>
  +<p>Cut - collapsed selection</p>
   <!-- /wp:paragraph -->


    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/copy-cut-paste.spec.js:45:49
sort patterns (Site Editor v2) in /test/e2e/specs/site-editor/patterns.spec.js, passed after 1 failed attempt.
Error: apiRequestContext.fetch: socket hang up
Call log:
  - → POST http://localhost:8889/wp-json/wp/v2/blocks
    - user-agent: Playwright/1.63.0 (x64; ubuntu 24.04) node/24.18 CI/1
    - accept: */*
    - accept-encoding: gzip,deflate,br
    - X-WP-Nonce: 05da2ffb91
    - content-type: application/json
    - content-length: 133
    - cookie: wordpress_test_cookie=WP%20Cookie%20check; wordpress_logged_in_23778236db82f19306f247e20a353a99=admin%7C1790774434%7Cr1Q7Ca7hcn7XfIhajOvWwLNeSJ4twyUnhr8k1VdnAWk%7Ca7f19cd672745c0e616d977499fedee4d73808e771d4f1ddb96293e3c6305259; wp-settings-time-1=1790601932

    at RequestUtils.rest (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/rest.ts:112:39)
    at RequestUtils.createRecord (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/records.ts:20:14)
    at RequestUtils.createBlock (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/blocks.ts:54:14)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/patterns.spec.js:241:17

5ad9600 Run

@github-actions github-actions Bot added the [Package] Block editor /packages/block-editor label Sep 15, 2026
@ciampo ciampo added the [Type] Enhancement A suggestion for improvement. label Sep 15, 2026
@ciampo ciampo self-assigned this Sep 15, 2026
@ciampo
ciampo force-pushed the codex/widgets-move-area-ui-menu branch from 33dd3a2 to 822d991 Compare September 25, 2026 13:27
@ciampo
ciampo marked this pull request as ready for review September 28, 2026 14:16
@ciampo
ciampo requested a review from ellatrix as a code owner September 28, 2026 14:16
@ciampo
ciampo requested review from a team, Mamaduka, andrewserong and ramonjd and removed request for ellatrix September 28, 2026 14:16
@jameskoster

Copy link
Copy Markdown
Contributor

I guess this one should use the toolbar variant to maintain that appearance?

@ciampo

ciampo commented Sep 28, 2026

Copy link
Copy Markdown
Contributor Author

I guess this one should use the toolbar variant to maintain that appearance?

Yeah I forgot to pre-address that part.

@wordpress/ui popovers (including Menu) for now don't have toolbar variants. The UI Popover example uses local styles for a toolbar-like appearance and leaves a shared variant for later. Should we take that approach here, then discuss separately whether toolbar styling is a pattern @wordpress/ui should officially support?

Alternatively, if we're strongly convinced that we will continue to need / use that different visual treatment, we can implement it to Popover and Menu (maybe using a more "generic" name than toolbar) ?

@jasmussen

Copy link
Copy Markdown
Contributor

I knew this question would come up at one point. Notably the ellipsis menu for block toolbars will substantially benefit from flyouts. I was hoping it would look okay, but honestly this discrepancy looks like a bug.

What are our options for supplying a light reskin of dropdowns just for block toolbar menus?

@ciampo

ciampo commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

I considered keeping the overrides in shared block-editor wrappers, but these menus live in several packages. That would mean adding wrapper APIs that other packages need to import and maintain across versions. Adding a visual variant to Menu.Popup and Popover.Popup seems like the simpler option, with the same approach available to other components if needed later.

For the name, toolbar describes the current use case, while strong or high-contrast would describe the appearance more generally.

@WordPress/gutenberg-components , @WordPress/gutenberg-design and @Mamaduka , WDYT ?

@jasmussen

Copy link
Copy Markdown
Contributor

I like "high contrast", but I'll defer to Jay if he has opinions.

@ciampo

ciampo commented Sep 30, 2026

Copy link
Copy Markdown
Contributor Author

Adding the "high contrast" variant to Menu and Popover in #83850

@t-hamano

Copy link
Copy Markdown
Contributor

No decision has been made yet, but there is a proposal to remove the heavy border from the block toolbar. See #67426. I'm concerned that the new variant might become redundant if we decide to make the block toolbar borderless in the future.

@ciampo

ciampo commented Sep 30, 2026

Copy link
Copy Markdown
Contributor Author

Sounds like we should make that call sooner rather than later 😅

@t-hamano

t-hamano commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Should we try the unstyled variant for the block toolbar first? That might help ui/Menu integrate more seamlessly with it. We will likely need to build the new block toolbar from scratch based on the design system, but this approach could make it easier to move this PR forward.

I tried vibe coding an unstyled block toolbar. What do you think? Conversely, if the unstyled block toolbar is not well received, it means we will continue to keep the high-contrast look for the block toolbar, which might allow us to move forward with #83850.

https://playground.wordpress.net/?gutenberg-pr=84022

image

@ciampo

ciampo commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

Thank you @t-hamano , I believe @WordPress/gutenberg-design folks plan to take a look at the whole toolbar design situation soon, I expect them to provide feedback in the upcoming week(s)

This branch has not been deployed

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

Labels

[Package] Block editor /packages/block-editor [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants