Skip to content

Widgets: Use UI Menu for editor and Customizer options - #82967

Open
ciampo wants to merge 4 commits into
trunkfrom
codex/widgets-options-ui-menu
Open

ciampo wants to merge 4 commits into
trunkfrom
codex/widgets-options-ui-menu

Conversation

@ciampo

@ciampo ciampo commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Part of #61094.

What?

Use @wordpress/ui Menu for the Widgets and Customizer Options menus.

Why?

Migrate these menus while keeping preferences, announcements, and help dialogs working as before.

How?

Each package renders its own menu parts so they share the same bundled context. The Widgets screen keeps its legacy menu when extensions fill the existing Tools slot; arbitrary legacy items cannot participate in the new Menu's keyboard navigation.

Includes the same toolbar and Customizer overlay compatibility fixes as #82966 so this PR can be tested and merged independently.

Testing Instructions

Activate a classic theme (ie TwentyTwentySeventeen)

Open Appearance → Widgets and its Options menu. Toggle Top toolbar, Contain text cursor inside block, Use theme styles, and Display block breadcrumbs. Check that their selected states and behavior update, and that preference changes are announced. Open Keyboard shortcuts and Welcome Guide; each dialog should remain open after the menu closes. Check the Help link.

Repeat the available controls in the Widgets Customizer, including with a block selected. Extensions using EditWidgetsToolsMoreMenuGroup should retain their existing actions and navigation.

Testing Instructions for Keyboard

Open Options with Enter. Navigate with arrow keys and toggle a preference with Space. Escape should close the menu and return focus to Options. After opening and dismissing Keyboard shortcuts, focus should return to Options. In the Customizer, verify the Options trigger remains part of the Document tools toolbar navigation.

Screenshots

Before After
Screenshot 2026-09-28 at 15 58 12 Screenshot 2026-09-28 at 15 58 12
Screenshot 2026-09-28 at 15 56 08 Screenshot 2026-09-28 at 15 58 30

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 🤖

📦 Bundle size

Size Change: +68.7 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 93.5 kB +34.2 kB (+57.81%) 🆘
build/scripts/edit-widgets/index.min.js 102 kB +34.5 kB (+51.54%) 🆘
build/styles/customize-widgets/style-rtl.css 2.75 kB -22 B (-0.79%)
build/styles/customize-widgets/style-rtl.min.css 1.74 kB -22 B (-1.25%)
build/styles/customize-widgets/style.css 2.74 kB -21 B (-0.76%)
build/styles/customize-widgets/style.min.css 1.74 kB -22 B (-1.25%)

dde336d Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric bf88982 trunk % Change
timeToFirstByte 62.4 ms +14.26% -3.85% 59.5 ms +10.59% -3.61% 4.87%
largestContentfulPaint 108 ms +3.7% -9.26% 100 ms +6% -8% 8%
lcpMinusTtfb 38.35 ms +22.03% -5.48% 36.05 ms +19.56% -2.5% 6.38%
wpBeforeTemplate 31.8 ms +13.08% -5.57% 29.53 ms +14.83% -2.54% 7.69%
wpTemplate 26.67 ms +4.27% -3.37% 25.33 ms +4.26% -3.87% 5.29%
wpTotal 58.58 ms +12.6% -3.96% 55.73 ms +10.34% -4.02% 5.11%
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 bf88982 trunk % Change
timeToFirstByte 50.95 ms +6.38% -3.53% 49.9 ms +4.21% -1.7% 2.1%
largestContentfulPaint 108 ms +3.7% -1.85% 108 ms +0% -3.7% 0%
lcpMinusTtfb 57.3 ms +2.09% -2.09% 55.75 ms +3.77% -1.26% 2.78%
wpBeforeTemplate 27.88 ms +12.09% -2.8% 27.65 ms +3.83% -1.99% 0.83%
wpTemplate 18.88 ms +4.98% -2.07% 18.69 ms +3.91% -1.18% 1.02%
wpTotal 48.01 ms +5.92% -4.08% 46.63 ms +4.78% -1.65% 2.96%
wpMemoryUsage 6.22 MB +0% -0% 6.19 MB +0% -0% 0.58%
wpDbQueries 14 +0% -0% 14 +0% -0% 0%

media-processing

Metric bf88982 trunk % Change
mediaProcessingJpeg 397.6 ms +1.96% -0.37% 402.26 ms +1.03% -1.56% -1.16%
mediaProcessingAvif 6089.76 ms +0.32% -0.15% 6086.27 ms +0.04% -0.34% 0.06%
mediaProcessingJpegToAvif 4222.69 ms +0.06% -0.54% 4192.3 ms +0.22% -0.11% 0.72%

media-upload

Metric bf88982 trunk % Change
jpegUploadProcessing 1434.74 ms +35.88% -1.26% 1436.06 ms +1.15% -1.27% -0.09%
pngUploadProcessing 195.39 ms +14.06% -5.94% 212.95 ms +18.65% -10.75% -8.25%
largeJpegUploadProcessing 1425.22 ms +1.34% -0.87% 1415.87 ms +0.7% -0.6% 0.66%
multipleImageUploadProcessing 1598.06 ms +0.3% -0.38% 2075.14 ms +2.19% -20.11% -22.99%

post-editor

Metric bf88982 trunk % Change
serverResponse 402.82 ms +4.76% -5.44% 406.47 ms +3.8% -3.59% -0.9%
firstPaint 240.68 ms +34.8% -18.34% 210.43 ms +47.98% -6.62% 14.38%
domContentLoaded 1024.37 ms +3.15% -3.89% 1014.65 ms +0.72% -0.77% 0.96%
loaded 1025.57 ms +3.14% -3.89% 1015.87 ms +0.72% -0.78% 0.95%
firstContentfulPaint 423.04 ms +4.94% -4.24% 417.19 ms +1.98% -2.97% 1.4%
firstBlock 3024.46 ms +1.08% -1.03% 2982.26 ms +1.08% -0.66% 1.42%
type 17.38 ms +9.9% -6.9% 17.01 ms +2.88% -3.35% 2.18%
typeWithoutInspector 16.64 ms +5.29% -3.91% 16.52 ms +8.41% -3.93% 0.73%
typeWithTopToolbar 20.91 ms +14.2% -1.63% 22.09 ms +5.07% -7.2% -5.34%
typeContainer 1.16 ms +6.03% -45.69% 1.14 ms +21.93% -40.35% 1.75%
focus 12.75 ms +39.61% -4.86% 12.73 ms +6.28% -1.26% 0.16%
firstFocus 30.36 ms +0% -0% 29.44 ms +0% -0% 3.12%
selectAll 1388.76 ms +4.77% -0.99% 1403.37 ms +0.09% -0.09% -1.04%
listViewOpen 59.04 ms +6.18% -9.25% 58.85 ms +7.7% -12.12% 0.32%
inserterOpen 23.52 ms +6.29% -11.01% 22.31 ms +4.48% -1.97% 5.42%
inserterHover 2.13 ms +7.51% -6.1% 2.12 ms +6.6% -6.6% 0.47%
inserterSearch 8.12 ms +14.53% -2.09% 7.84 ms +14.29% -3.7% 3.57%
loadPatterns 669.28 ms +2.96% -3.94% 658.23 ms +4.5% -5.1% 1.68%
wpTotal 393.35 ms +4.9% -5.54% 396.79 ms +3.97% -3.61% -0.87%
wpMemoryUsage 13.14 MB +0% -0% 13.11 MB +0% -0% 0.28%
wpDbQueries 54 +0% -1.85% 54 +0% -0% 0%

site-editor

Metric bf88982 trunk % Change
serverResponse 483.59 ms +4.38% -5.72% 489.67 ms +1.52% -7% -1.24%
firstPaint 246.92 ms +5.97% -18.35% 233.31 ms +4.65% -5.67% 5.83%
domContentLoaded 1137.83 ms +1.31% -0.33% 1138.38 ms +1.02% -1.06% -0.05%
loaded 1138.98 ms +1.32% -0.32% 1139.53 ms +1.02% -1.05% -0.05%
firstContentfulPaint 449.01 ms +3.53% -2.74% 447.37 ms +0.76% -0.64% 0.37%
firstBlock 4153.25 ms +0.61% -0.96% 4107.66 ms +0.35% -0.5% 1.11%
type 18.23 ms +5.27% -5.76% 17.44 ms +3.04% -1.55% 4.53%
navigate 99.29 ms +11.04% -1.67% 107.15 ms +11.54% -2.9% -7.34%
loadPatterns 1295.36 ms +3.41% -4.8% 1218.73 ms +19.6% -4.71% 6.29%
loadPages 1049.04 ms +4.21% -1.05% 1052.75 ms +2.33% -1.18% -0.35%
wpTotal 473.96 ms +4.48% -5.86% 480.4 ms +1.52% -7.14% -1.34%
wpMemoryUsage 12.11 MB +0% -0% 12.09 MB +0% -0% 0.13%
wpDbQueries 43.5 +1.15% -1.15% 43.5 +1.15% -1.15% 0%

dde336d Run

🏁 Flaky tests

Show the failures

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.

two users concurrently move list items (RTC WebSocket) in /test/e2e/specs/editor/collaboration/collaboration-stress.spec.ts, passed after 1 failed attempt.
Error: expect(received).toBeGreaterThan(expected)

Expected: > 2
Received:   1

Call Log:
- Timeout 10000ms exceeded while waiting on the predicate
    at assertMovedOrder (/home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/collaboration/collaboration-stress.spec.ts:646:8)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/collaboration/collaboration-stress.spec.ts:650:10

dde336d Run

@github-actions github-actions Bot added [Package] Block editor /packages/block-editor [Package] Edit Widgets /packages/edit-widgets labels 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-options-ui-menu branch from c6c6fa4 to ea2be71 Compare September 25, 2026 13:23
@ciampo
ciampo marked this pull request as ready for review September 28, 2026 14:00
@ciampo
ciampo requested a review from ellatrix as a code owner September 28, 2026 14:00
@ciampo
ciampo requested review from Mamaduka and a balanced review from Copilot September 28, 2026 14:00
@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

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: Mamaduka <mamaduka@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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Cross-document focus, extension fallback, and Customizer overlay behavior require final interactive human verification.

Review effort: Balanced
Findings: None

What changed in this PR

Migrates Widgets and Customizer Options menus to @wordpress/ui while preserving extension compatibility, preferences, dialogs, and focus behavior.

Changes:

  • Adds package-local UI Menu implementations and preference controls.
  • Preserves the legacy Widgets menu when extension fills exist.
  • Handles Customizer overlays and toolbar focus guards, with browser coverage.
File Description
packages/​edit-widgets/​src/​components/​more-menu/​ui-menu.tsx Adds the new Widgets Options menu.
packages/​edit-widgets/​src/​components/​more-menu/​more-menu-preference-item.tsx Adds UI Menu preference toggles.
packages/​edit-widgets/​src/​components/​more-menu/​index.jsx Selects the new or extension-compatible legacy menu.
packages/​edit-widgets/​CHANGELOG.md Records the migration.
packages/​customize-widgets/​src/​style.scss Removes obsolete menu styling.
packages/​customize-widgets/​src/​components/​more-menu/​style.scss Deletes the legacy z-index override.
packages/​customize-widgets/​src/​components/​more-menu/​more-menu-preference-item.tsx Adds Customizer preference toggles.
packages/​customize-widgets/​src/​components/​more-menu/​index.jsx Migrates the Customizer Options menu.
packages/​customize-widgets/​src/​components/​customize-widgets/​use-clear-selected-block.js Preserves selection during UI overlay interaction.
packages/​customize-widgets/​CHANGELOG.md Records the migration.
packages/​block-editor/​src/​components/​navigable-toolbar/​test/​index.browser.test.js Tests portaled-menu toolbar stability.
packages/​block-editor/​src/​components/​navigable-toolbar/​index.jsx Excludes focus guards from toolbar controls.
packages/​block-editor/​CHANGELOG.md Records the toolbar fix.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@ciampo
ciampo requested review from a team September 28, 2026 14:09
@jameskoster

Copy link
Copy Markdown
Contributor

Both (probably) separate issues, but:

  1. I'm not sure the toolbar variant works very well in the Customizer
  2. The menu in the widget editor looks a bit wide. Should the popover have a max-width (informed by surface-width tokens)?

@ciampo

ciampo commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor Author

I'm not sure the toolbar variant works very well in the Customizer

Re. toolbar variant, see reply in #82966 (comment)

The menu in the widget editor looks a bit wide. Should the popover have a max-width (informed by surface-width tokens)?

The Menu popover already has a max-width, but it is wider than the previous Menu components (--wpds-dimension-surface-width-md, ie 400px).

What we can do here is to add a custom max width for this specific case. (also cc @mirka who recently worked on width presets for some popups; at the time, we decided explicitly not to add such presents to the menu's popup)

Comment on lines +24 to +27
const toolsFills = useSlotFills( 'EditWidgetsToolsMoreMenuGroup' );
// Existing fills may contain arbitrary legacy controls. Preserve their menu
// context and keyboard navigation.
return toolsFills?.length ? <LegacyMoreMenu /> : <MoreMenuWithUI />;

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.

Why not use the same migration method we've used for the editor menu?

@Mamaduka

Copy link
Copy Markdown
Member

What we can do here is to add a custom max width for this specific case.

I personally like a consistent width for MoreMenu, though I think @mirka has a different opinion. See #82976.

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 [Package] Edit Widgets /packages/edit-widgets [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants