Skip to content

Editor: Add Inspector and use radios in the Panels menu - #84033

Open
ciampo wants to merge 5 commits into
trunkfrom
codex/panels-menu-inspector
Open

ciampo wants to merge 5 commits into
trunkfrom
codex/panels-menu-inspector

Conversation

@ciampo

@ciampo ciampo commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to the discussion in #83993.

What?

Add Inspector to the Panels submenu and use radios to select the active panel. Inspector is selected when either the document or block inspector is open. Keep Panels hidden when Inspector is the only available panel.

Why?

In the site editor, Panels can contain only an unchecked Styles item while Inspector is open. Listing Inspector makes the active panel clear and gives the submenu two choices. A plain post editor with no plugin panels does not need the submenu.

How?

Use the shared editor menu for the post editor and both site editor versions. Keep the existing plugin menu items, and render the submenu only when another panel contributes an item. Omit Inspector in distraction-free mode, which hides the sidebar.

Selecting an active radio keeps its panel open. Selecting Inspector from another panel opens the document or block inspector according to the current block selection. Closing the sidebar with its close button leaves no radio selected.

Remove the obsolete @wordpress/interface type shim from the Vitest validator so the menu tests use the package's actual store types.

Testing Instructions

  1. Open a template in the site editor with Settings open. Open Options → Panels. Inspector should be checked and Styles unchecked.
  2. Choose Styles, then reopen Panels. Styles should be checked and Inspector unchecked. Choose Inspector to switch back.
  3. Select the active Inspector or Styles radio again. Confirm its panel stays open. Close the sidebar with its close button, reopen Panels, and confirm neither radio is selected. Choose Inspector to reopen it.
  4. Select a block, switch to Styles, then choose Inspector. The block inspector should open.
  5. Open a plain post with no plugin sidebars. Confirm Options has no Panels submenu and the toolbar Settings button still opens and closes Inspector. With a plugin sidebar registered, confirm Panels contains Inspector and the plugin radio. Selecting the active plugin radio again should keep its sidebar open.
  6. With a plugin sidebar registered, enable Options → Appearance → Distraction free. Confirm Panels keeps the plugin items and omits Inspector. Disable Distraction free and confirm Inspector returns checked.
  7. Repeat the template checks with the Extensible Site Editor experiment enabled.

Testing Instructions for Keyboard

  1. Focus Options and press Enter. Use the arrow keys to reach Panels, then press Right Arrow to open it.
  2. Use Up and Down Arrow to move between Inspector and Styles. Press Enter to activate an item. Confirm its panel opens and focus returns to Options. Activate the selected radio again and confirm the panel stays open.
  3. Reopen Panels. Press Escape to return to Panels, then Escape again to return to Options.

Screenshots or screencast

Before: Inspector open, only Styles listed After: Inspector listed and checked
Before: only unchecked Styles appears while Inspector is open After: Inspector is checked and Styles is unchecked
Styles open Post editor: Inspector is the only panel
Styles is checked and Inspector is unchecked Post editor Options menu without a Panels submenu
Verification

The production build, type check, changed-file JavaScript lint, changelog validation, and full Vitest convention check passed. All 39 menu tests passed. Native browser checks covered both site editor versions, the post editor, and keyboard selection and reselection of a real plugin sidebar.

The Panels adapter opts default complementary-area items into radios. Older hosts, older interface fills, and explicit checkbox overrides retain checkbox toggles. Generic plugin actions and links remain menu items. The interface package documents the selection behavior.

Use of AI Tools

Codex assisted with investigation, implementation, regression tests, verification, and this description.

@github-actions github-actions Bot added the [Package] Editor /packages/editor label Oct 2, 2026
@ciampo ciampo added the [Type] Enhancement A suggestion for improvement. label Oct 2, 2026
@github-actions

github-actions Bot commented Oct 2, 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: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: jasmussen <joen@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: +538 B (+0.01%)

Total Size: 8.25 MB

📦 View Changed
Filename Size Change
build/scripts/edit-widgets/index.min.js 67.1 kB +63 B (+0.09%)
build/scripts/editor/index.min.js 616 kB +475 B (+0.08%)

19018ad Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric ab900ab trunk % Change
timeToFirstByte 61.55 ms +8.85% -7.96% 58.25 ms +8.5% -4.29% 5.67%
largestContentfulPaint 100 ms +12% -4% 96 ms +4.17% -4.17% 4.17%
lcpMinusTtfb 39.85 ms +15.81% -8.78% 34.8 ms +13.36% -4.74% 14.51%
wpBeforeTemplate 30.52 ms +14.19% -7.27% 28.68 ms +10.84% -1.53% 6.42%
wpTemplate 25.42 ms +2.75% -4.64% 25.01 ms +4.72% -4.48% 1.64%
wpTotal 57.31 ms +7.94% -7.56% 54.46 ms +8.94% -4.63% 5.23%
wpMemoryUsage 7.63 MB +0% -0% 7.59 MB +0% -0% 0.46%
wpDbQueries 17 +0% -0% 17 +0% -0% 0%

front-end-classic-theme

Metric ab900ab trunk % Change
timeToFirstByte 49.75 ms +5.33% -1.21% 48.75 ms +3.28% -2.56% 2.05%
largestContentfulPaint 108 ms +3.7% -3.7% 104 ms +1.92% -0% 3.85%
lcpMinusTtfb 57.6 ms +2.69% -3.82% 55.55 ms +2.52% -2.61% 3.69%
wpBeforeTemplate 27.43 ms +4.08% -1.68% 26.72 ms +4.08% -2.25% 2.66%
wpTemplate 18.85 ms +2.12% -2.28% 18.15 ms +5.62% -1.76% 3.86%
wpTotal 46.52 ms +5.22% -1.61% 45.68 ms +3.02% -2.76% 1.84%
wpMemoryUsage 6.25 MB +0% -0% 6.21 MB +0% -0% 0.71%
wpDbQueries 14 +0% -0% 14 +0% -0% 0%

media-processing

Metric ab900ab trunk % Change
mediaProcessingJpeg 400.66 ms +1.07% -0.2% 405.16 ms +0.84% -0.24% -1.11%
mediaProcessingAvif 6089.49 ms +0.25% -0.35% 6085.93 ms +0.29% -0.19% 0.06%
mediaProcessingJpegToAvif 4201.14 ms +0.52% -0.48% 4196.89 ms +0.1% -0.2% 0.1%

media-upload

Metric ab900ab trunk % Change
jpegUploadProcessing 1709.71 ms +14.81% -16.67% 1430.73 ms +1.66% -0.79% 19.5%
pngUploadProcessing 220.2 ms +2.23% -13.83% 205.78 ms +15.95% -11.5% 7.01%
largeJpegUploadProcessing 1420.03 ms +0.63% -0.7% 1418.85 ms +0.98% -0.94% 0.08%
multipleImageUploadProcessing 1609.71 ms +8.78% -1.38% 1610.73 ms +26.98% -0.71% -0.06%

post-editor

Metric ab900ab trunk % Change
serverResponse 416.77 ms +4.59% -7.14% 410.22 ms +2.49% -2.33% 1.6%
firstPaint 218.6 ms +13.46% -11.99% 207.51 ms +36.34% -14.26% 5.34%
domContentLoaded 1011.75 ms +3% -1.83% 974.98 ms +0.64% -1.68% 3.77%
loaded 1012.98 ms +2.99% -1.85% 976.17 ms +0.66% -1.69% 3.77%
firstContentfulPaint 424.74 ms +2.18% -0.74% 408.39 ms +2.56% -1.71% 4%
firstBlock 2891.5 ms +0.94% -2.01% 2780.76 ms +1.89% -0.26% 3.98%
type 17.85 ms +1.85% -2.63% 17.16 ms +7.23% -2.51% 4.02%
typeWithoutInspector 16.99 ms +5.41% -3.77% 17.16 ms +2.97% -5.36% -0.99%
typeWithTopToolbar 22.51 ms +0.84% -1.24% 21.94 ms +2.78% -5.42% 2.6%
typeContainer 8.49 ms +7.18% -1.88% 8.39 ms +3.69% -7.51% 1.19%
focus 69.81 ms +4.97% -5.41% 68.62 ms +10.27% -4.02% 1.73%
firstFocus 187.75 ms +0% -0% 186.47 ms +0% -0% 0.69%
selectAll 402.19 ms +1.77% -0.51% 387.69 ms +5.49% -3.43% 3.74%
listViewOpen 55.94 ms +6.58% -1.23% 55.04 ms +8.28% -12.63% 1.64%
inserterOpen 22.61 ms +8.67% -10.35% 22.62 ms +23.03% -8.09% -0.04%
inserterHover 2.17 ms +6.91% -1.84% 2.11 ms +15.64% -11.37% 2.84%
inserterSearch 7.93 ms +17.78% -3.78% 8.74 ms +6.86% -14.19% -9.27%
loadPatterns 652.26 ms +10.29% -2.79% 647.77 ms +7.8% -2.28% 0.69%
wpTotal 406.55 ms +4.65% -7.34% 400.37 ms +2.15% -2.58% 1.54%
wpMemoryUsage 13.18 MB +0% -0% 13.14 MB +0% -0% 0.28%
wpDbQueries 54 +0% -1.85% 54 +0% -0% 0%

site-editor

Metric ab900ab trunk % Change
serverResponse 518.85 ms +3.1% -5.41% 521.49 ms +2.16% -7.19% -0.51%
firstPaint 257.01 ms +75.98% -12.37% 265.98 ms +15.06% -14.4% -3.37%
domContentLoaded 1171.05 ms +3.19% -1.19% 1187.42 ms +1.38% -1.64% -1.38%
loaded 1172.49 ms +3.16% -1.2% 1188.71 ms +1.38% -1.64% -1.36%
firstContentfulPaint 471.87 ms +2.43% -3.71% 468.68 ms +2.19% -1.68% 0.68%
firstBlock 4375.7 ms +0.4% -0.84% 4287.21 ms +0.34% -0.62% 2.06%
type 18.87 ms +4.29% -3.71% 18.6 ms +3.82% -7.69% 1.45%
navigate 122.01 ms +6.75% -6.97% 127.74 ms +6.78% -4.52% -4.49%
loadPatterns 1378.78 ms +19.15% -4.65% 1416.87 ms +2.3% -8.32% -2.69%
loadPages 1095.05 ms +1.5% -0.69% 1058.67 ms +4.12% -0.82% 3.44%
wpTotal 508.82 ms +3.27% -5.5% 511.87 ms +2.08% -7.4% -0.6%
wpMemoryUsage 12.14 MB +0% -0% 12.10 MB +0% -0% 0.3%
wpDbQueries 43 +2.33% -0% 43 +2.33% -0% 0%

19018ad Run

@Mamaduka

Mamaduka commented Oct 2, 2026

Copy link
Copy Markdown
Member

Maybe we should just remove Styles from the panels submenu. I think it ended up there by accident; we've floated the idea of removing it a couple of times. cc @youknowriad, @jasmussen

P.S. There's also an easy way to add Settings to the Panels submenu. Just add name={ tabName } to PluginSidebar in packages/editor/src/components/sidebar/index.jsx.

@ciampo ciampo changed the title Editor: Add Inspector to the Panels menu Editor: Add Inspector and use radios in the Panels menu Oct 2, 2026
@github-actions github-actions Bot added the [Package] Interface /packages/interface label Oct 2, 2026
@ciampo
ciampo marked this pull request as ready for review October 2, 2026 17:40
@ciampo

ciampo commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

I'll wait for "product" feedback re. whether we want to keep "Styles" in the panels submenu at all, before making further code changes

@jasmussen

Copy link
Copy Markdown
Contributor

Not feeling strongly about this. But "Panels" is what we call any sidebar. The inspector panel, the styles panel, or anything a plugin adds. It's possible we omitted these because we needed to save space in the dropdown, but if we do go in the direction of a flyout, then it seems useful to include every available panel so you know the behavior: that selecting another panel closes the one you already have open.

@ciampo

ciampo commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

if we do go in the direction of a flyout, then it seems useful to include every available panel so you know the behavior: that selecting another panel closes the one you already have open.

This was the angle I approach this PR — mentioning all panels in that submenu would make it more complete / correct, and would remove some awkwardness (one extra entry in the submenu, higher likelihood that there is a checked item in the panel)

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] Editor /packages/editor [Package] Interface /packages/interface [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants