Skip to content

Media editor: Build the sidebar tabs from mounted panels - #84664

Merged
ramonjd merged 33 commits into
trunkfrom
add/media-editor-panel-registry
Dec 2, 2026
Merged

ramonjd merged 33 commits into
trunkfrom
add/media-editor-panel-registry

Conversation

@ramonjd

@ramonjd ramonjd commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

What?

Part of #79175.

Plugins can add their own tabs to the media editor's sidebar, the way PluginSidebar adds one to the post editor. Crop and Details are built the same way. This works in the post editor's modal and on the media editor page.

Nothing changes on screen. Nothing is exported yet either, so plugins can't use it until a follow-up exposes it.

Why?

Extensions such as filters or an AI tool (WordPress/ai#325) have nowhere to go in the media editor.

Testing Instructions

  1. Insert an Image block, choose an image, and click "Edit image" in the block toolbar.
  2. On a wide screen, the sidebar is open on Crop, then Details, as on trunk. It does not slide in. On the media editor page it is open on Details, then Crop.
  3. Crop, change the aspect ratio, edit the alt text, and save.
  4. Open the editor for a PDF or a video: only Details shows.
  5. Resize the window below 600px and back: the panel closes and opens as on trunk.

@github-actions

github-actions Bot commented Oct 14, 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: ramonjd <ramonopoly@git.wordpress.org>
Co-authored-by: andrewserong <andrewserong@git.wordpress.org>
Co-authored-by: oandregal <oandregal@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.34 kB (+0.02%)

Total Size: 8.73 MB

📦 View Changed
Filename Size Change
build/scripts/editor/index.min.js 575 kB +1.34 kB (+0.23%)

d548f03 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric 5e627a0 trunk % Change
timeToFirstByte 34.95 ms +9.01% -4.29% 34.6 ms +7.51% -4.48% 1.01%
largestContentfulPaint 60 ms +6.67% -6.67% 56 ms +7.14% -7.14% 7.14%
lcpMinusTtfb 22.1 ms +22.85% -7.92% 20.65 ms +6.54% -6.54% 7.02%
wpBeforeTemplate 18.3 ms +10.16% -1.53% 17.94 ms +8.92% -1.84% 2.01%
wpTemplate 13.35 ms +7.12% -5.39% 13.23 ms +6.35% -4.99% 0.91%
wpTotal 32.05 ms +8.67% -4.31% 31.63 ms +8.44% -5.03% 1.33%
wpMemoryUsage 7.75 MB +0% -0% 7.72 MB +0% -0% 0.45%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric 5e627a0 trunk % Change
timeToFirstByte 29.3 ms +9.73% -1.71% 29.65 ms +4.22% -4.38% -1.18%
largestContentfulPaint 54 ms +7.41% -3.7% 52 ms +7.69% -0% 3.85%
lcpMinusTtfb 23.6 ms +8.05% -2.12% 23.55 ms +4.46% -5.1% 0.21%
wpBeforeTemplate 16.4 ms +11.28% -0.98% 16.25 ms +9.35% -1.48% 0.92%
wpTemplate 9.97 ms +10.63% -2.01% 9.9 ms +7.07% -1.92% 0.71%
wpTotal 26.79 ms +8.66% -1.9% 26.83 ms +6.19% -4.06% -0.15%
wpMemoryUsage 6.44 MB +0% -0% 6.41 MB +0% -0% 0.56%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric 5e627a0 trunk % Change
mediaProcessingJpeg 215.82 ms +0.17% -1.12% 220.34 ms +4.18% -2.74% -2.05%
mediaProcessingAvif 3598.77 ms +0.75% -0.21% 3610.88 ms +3.79% -1.01% -0.34%
mediaProcessingJpegToAvif 2465.43 ms +0.66% -0.08% 2591.64 ms +2.47% -5.02% -4.87%

media-upload

Metric 5e627a0 trunk % Change
jpegUploadProcessing 1438.03 ms +0.35% -1.09% 1430.52 ms +0.19% -0.18% 0.52%
pngUploadProcessing 186.07 ms +1.89% -2.18% 215.6 ms +2.89% -4.28% -13.7%
largeJpegUploadProcessing 1417.55 ms +1.33% -0.56% 1432.18 ms +1.25% -0.87% -1.02%
multipleImageUploadProcessing 1479.28 ms +0.63% -0.83% 1499.93 ms +0.34% -0.9% -1.38%

post-editor

Metric 5e627a0 trunk % Change
serverResponse 479.78 ms +3.16% -0.53% 473.46 ms +2.78% -8.07% 1.33%
firstPaint 434.92 ms +5.24% -16.85% 385.04 ms +4.79% -4.13% 12.95%
domContentLoaded 797.67 ms +5.26% -0.64% 797.3 ms +2.29% -0.47% 0.05%
loaded 798.75 ms +5.25% -0.61% 798.35 ms +2.3% -0.45% 0.05%
firstContentfulPaint 453.38 ms +11.86% -2.07% 445.42 ms +4.84% -1.07% 1.79%
firstBlock 2192.35 ms +1.41% -0.91% 2187.61 ms +0.72% -1.14% 0.22%
type 17.88 ms +5.09% -6.1% 17.36 ms +11.81% -6.05% 3%
typeWithoutInspector 19.3 ms +6.27% -15.65% 17.91 ms +8.88% -11.84% 7.76%
typeWithTopToolbar 22.96 ms +5.66% -4.09% 22.42 ms +7.63% -5.04% 2.41%
typeContainer 8.21 ms +5.97% -9.87% 8.66 ms +6% -12.59% -5.2%
focus 106.3 ms +2.8% -5.99% 114.84 ms +6.29% -2.87% -7.44%
firstFocus 265.17 ms +0% -0% 288.94 ms +0% -0% -8.23%
selectAll 406.57 ms +2.65% -5.02% 425.86 ms +1.63% -0.6% -4.53%
undo 27.96 ms +3.61% -1.29% 31.26 ms +5.92% -3.23% -10.56%
listViewOpen 39.58 ms +7.68% -3.84% 39.82 ms +8.11% -5.17% -0.6%
inserterOpen 40.51 ms +3.9% -8.57% 39.69 ms +12.62% -5.67% 2.07%
inserterHover 10.62 ms +9.04% -7.63% 11.45 ms +8.3% -9.17% -7.25%
inserterSearch 7.92 ms +8.33% -3.28% 7.71 ms +11.8% -6.36% 2.72%
loadPatterns 610.04 ms +4.12% -2.73% 643.99 ms +5.31% -4.23% -5.27%
wpTotal 470.2 ms +2.93% -0.56% 463.96 ms +2.67% -8.33% 1.34%
wpMemoryUsage 14.80 MB +0% -0% 14.77 MB +0% -0% 0.25%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric 5e627a0 trunk % Change
serverResponse 409.09 ms +2.68% -0.94% 404.45 ms +1.5% -8.95% 1.15%
firstPaint 419.65 ms +8.95% -9.56% 401.63 ms +18.9% -4.3% 4.49%
domContentLoaded 835.52 ms +2.14% -1.1% 847.27 ms +1.14% -0.66% -1.39%
loaded 836.61 ms +2.11% -1.12% 848.5 ms +1.11% -0.66% -1.4%
firstContentfulPaint 461.75 ms +5.06% -2.27% 475.66 ms +1.15% -1.66% -2.92%
firstBlock 2553.01 ms +0.5% -0.79% 2577.66 ms +1.39% -1.2% -0.96%
type 18.09 ms +8.73% -9.18% 19.83 ms +2.92% -15.83% -8.77%
navigate 113.51 ms +9.94% -3.38% 114.62 ms +2.16% -0.58% -0.97%
loadPatterns 1430.08 ms +18.86% -17.92% 1351.78 ms +4.08% -9.16% 5.79%
loadPages 931.12 ms +1.46% -2.32% 932.58 ms +1.63% -1.01% -0.16%
wpTotal 397.83 ms +2.89% -0.79% 393.72 ms +1.52% -9.17% 1.04%
wpMemoryUsage 12.84 MB +0% -0% 12.80 MB +0% -0% 0.28%
wpDbQueries 45 +0% -0% 45 +0% -0% 0%

d548f03 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.

Actions are reachable via RIGHT/LEFT arrow keys in /test/e2e/specs/site-editor/dataviews-list-layout-keyboard.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeFocused() failed

Locator:  getByRole('row', { name: 'Page One Edit Actions' }).getByRole('button', { name: 'Edit' })
Expected: focused
Received: inactive
Timeout:  5000ms

Call log:
  - Expect "toBeFocused" getByRole('row', { name: 'Page One Edit Actions' }).getByRole('button', { name: 'Edit' }) with timeout 5000ms
  - waiting for getByRole('row', { name: 'Page One Edit Actions' }).getByRole('button', { name: 'Edit' })
    14 × locator resolved to <button type="button" tabindex="-1" class="components-button is-small" id="view-list-0-185-primary-action-edit-post">Edit</button>
       - unexpected value "inactive"

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/dataviews-list-layout-keyboard.spec.js:172:5

d548f03 Run

@ramonjd
ramonjd force-pushed the add/media-editor-panel-registry branch from 6c07a06 to d9129ee Compare October 23, 2026 00:49
@ramonjd

ramonjd commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

This PR doesn't expose any public or experimental public API yet, but you can manually test adding tabs with the following:

Export the component and state hook
diff --git a/packages/editor/src/private-apis.js b/packages/editor/src/private-apis.js
index 3ed92793fe0..ed69b7b9031 100644
--- a/packages/editor/src/private-apis.js
+++ b/packages/editor/src/private-apis.js
@@ -1,5 +1,6 @@
 import * as interfaceApis from '@wordpress/interface';
-import { lock } from './lock-unlock';
+import { privateApis as mediaEditorPrivateApis } from '@wordpress/media-editor';
+import { lock, unlock } from './lock-unlock';
 import BackButton from './components/header/back-button';
 import Editor from './components/editor';
 import PluginPostExcerpt from './components/post-excerpt/plugin';
@@ -21,6 +22,9 @@ import { GlobalStylesActionMenu } from './components/global-styles/menu';
 import UploadProgressSnackbar from './components/upload-progress-snackbar';
 
 const { store: interfaceStore, ...remainingInterfaceApis } = interfaceApis;
+// Media editor panels, re-exposed the way `PluginSidebar` is: a plugin
+// registers one from `registerPlugin( …, { scope: 'media-editor' } )`.
+const { MediaEditorPanel, useMediaEditor } = unlock( mediaEditorPrivateApis );
 
 export const privateApis = {};
 lock( privateApis, {
@@ -38,6 +42,8 @@ lock( privateApis, {
 	ViewMoreMenuGroup,
 	ResizableEditor,
 	UploadProgressSnackbar,
+	MediaEditorPanel,
+	useMediaEditor,
 	registerCoreBlockBindingsSources,
 	// Global Styles
 	GlobalStylesUIWrapper,
diff --git a/packages/media-editor/src/private-apis.ts b/packages/media-editor/src/private-apis.ts
index 261bb2022bc..b1b4149be00 100644
--- a/packages/media-editor/src/private-apis.ts
+++ b/packages/media-editor/src/private-apis.ts
@@ -2,10 +2,15 @@ import { lock } from './lock-unlock';
 import { store } from './store';
 import { MediaEditorModal } from './components/media-editor-modal';
 import { MediaEditor } from './components/media-editor';
+import MediaEditorPanel from './components/media-editor-panel';
+import { useMediaEditor } from './state';
 
 export const privateApis = {};
 lock( privateApis, {
 	store,
 	MediaEditor,
 	MediaEditorModal,
+	// For panels: the tab + slot, and the session they drive.
+	MediaEditorPanel,
+	useMediaEditor,
 } );
Add a panel from the browser console
const { unlock } = wp.privateApis.__dangerousOptInToUnstableAPIsOnlyForCoreModules(
	'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
	'@wordpress/editor'
);
const { MediaEditorPanel, useMediaEditor } = unlock( wp.editor.privateApis );
const { createElement: el } = wp.element;
const { RangeControl, Button } = wp.components;

function TesterPanel( { disabled } ) {
	const {
		edits, setEdit, setAspectRatioValue, cropper, beginGesture, endGesture,
	} = useMediaEditor();
	const amount = edits[ 'tester/vignette' ]?.amount ?? 0;
	return el( 'div', null,
		// One undo entry per drag: the gesture opens on pointer down, every
		// change during the drag coalesces, and pointer up commits it. The
		// same for a key held down. `data-crop-control` tells the editor the
		// slider is an image control, so Cmd+Z while it has focus still undoes.
		el( 'div', {
			role: 'presentation',
			'data-crop-control': true,
			onPointerDownCapture: beginGesture,
			onPointerUp: endGesture,
			onPointerCancel: endGesture,
			onKeyDownCapture: beginGesture,
			onKeyUp: endGesture,
		},
			el( RangeControl, {
				label: 'Vignette', value: amount, min: 0, max: 1, step: 0.05, disabled,
				onChange: ( next ) => setEdit( 'tester/vignette', next ? { amount: next } : undefined ),
			} )
		),
		el( Button, { disabled, onClick: () => setAspectRatioValue( '1' ) }, 'Square crop' ),
		el( Button, { disabled, onClick: () => cropper.setRotation( 90 ) }, 'Rotate 90°' )
	);
}

wp.plugins.registerPlugin( 'tester-panel', {
	scope: 'media-editor',
	render: () => el( MediaEditorPanel,
		{ name: 'tester/vignette', title: 'Tester', order: 30, mediaTypes: [ 'image' ] },
		( { disabled } ) => el( TesterPanel, { disabled } )
	),
} );
2026-10-23.12.36.52.mp4

@ramonjd ramonjd self-assigned this Oct 23, 2026
@ramonjd ramonjd added [Type] Enhancement A suggestion for improvement. [Feature] Media Anything that impacts the experience of managing media labels Oct 23, 2026
@ramonjd
ramonjd requested review from andrewserong and a balanced review from Copilot October 23, 2026 01:46
@ramonjd
ramonjd marked this pull request as ready for review October 23, 2026 01:46

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.

🟡 Changes recommended

Closing the media editor removes shared plugin subscriptions, preventing subsequent registration changes from notifying the host editor.

1 open issue
What changed in this PR

The media editor now builds sidebar tabs from mounted panels, laying the groundwork for extensions without exposing a public API.

Changes:

  • Adds panel registration, ordering, cleanup, and Slot/Fill rendering.
  • Migrates Crop and Details to panels and mounts scoped plugins inside the session provider.
  • Adds panel tests, architecture documentation, and dependency configuration.
File Description
packages/​media-editor/​tsconfig.json Adds the plugins project reference for development.
packages/​media-editor/​tsconfig.build.json Adds the plugins project reference for builds.
packages/​media-editor/​src/​image-editor/​docs/​architecture.md Documents mounted panels and session access.
packages/​media-editor/​src/​components/​media-editor/​index.tsx Builds tabs from panels and mounts scoped plugins.
packages/​media-editor/​src/​components/​media-editor-panel/​test/​index.jsdom.test.tsx Tests panel rendering, ordering, props, and lifecycle.
packages/​media-editor/​src/​components/​media-editor-panel/​index.tsx Implements panel registration and Slot/Fill content.
packages/​media-editor/​package.json Declares the plugins dependency.
package-lock.json Records the added dependency.

Review effort: Balanced

@github-actions github-actions Bot added the [Package] Plugins /packages/plugins label Oct 23, 2026
@ramonjd
ramonjd requested a balanced review from Copilot October 23, 2026 02:36

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 was unable to review this pull request because the user who requested the review has reached their quota limit.

@ramonjd

ramonjd commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

Actually, this is getting too big. I've a mind to return it to draft and split it up into a stacked PR once it's working properly.

  • register panels (this one)
  • error boundaries and ensuring panels can write to the canvas (for image changes like filters etc)

@andrewserong

andrewserong commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Actually, this is getting too big. I've a mind to return it to draft and split it up into a stacked PR once it's working properly.

Sounds good, let me know when it's ready for a closer look!

Just a drive-by comment re: naming. I'm wondering if MediaEditorPanel suggests a collapsible panel that would live inside one of the existing tabs (e.g. for a plugin that wants to add an additional panel to the Crop or Details tabs for example), rather than injecting a whole new tab? A bit like how PluginDocumentSettingPanel renders a slot inside a tab.

A couple of wording ideas: MediaEditorSidebarTab or MediaEditorTab (or Sidebar if we don't want to tie it to tab specifically)? Then panel could still be available further down the track if we want to allow plugins to inject within one of the existing tabs?

Anyway, just a nit-picky drive-by thought, I don't feel strongly about this! 🙂

@ramonjd

ramonjd commented Oct 26, 2026

Copy link
Copy Markdown
Member Author

Just a drive-by comment re: naming. I'm wondering if MediaEditorPanel suggests a collapsible panel that would live inside one of the existing tabs (e.g. for a plugin that wants to add an additional panel to the Crop or Details tabs for example), rather than injecting a whole new tab? A bit like how PluginDocumentSettingPanel renders a slot inside a tab.

This is a good point, thanks for raising it.

And maybe it won't be a tab one day too, e.g., accordion or some other UI. I don't want to paint things into a corner, and my guess it'd have to work with the media library too potentially.

I like Sidebar.

Or MediaEditorSection, which would mean MediaEditorSectionProps, MediaEditorSectionRegistration and so on.

I imagine this PR, or a version of it, would land a long time before we made the extension point public. I was hoping to get the crop panel using the registration system first to see how it landed.

There are a lot of tiny PRs to get to a public API in general. It'd be great, for example, if we could use a dumb cropper in the site settings > site icon crop step. Anyway, I digress. 😄

@andrewserong

Copy link
Copy Markdown
Contributor

And maybe it won't be a tab one day too, e.g., accordion or some other UI. I don't want to paint things into a corner, and my guess it'd have to work with the media library too potentially.
I like Sidebar.

Good point! In that case, yeah, I think Sidebar would work nicely, too

I imagine this PR, or a version of it, would land a long time before we made the extension point public. I was hoping to get the crop panel using the registration system first to see how it landed.

Oh, nice idea. Yes, in that case we'll have the "core" version of it all hooked up to demonstrate how it all works. We might then even make it possible for plugins to de-register or filter panels/sidebars that they don't want folks to see or use. I.e. a cropper that is just cropping but no details tab 🤔

In any case, now I digress 😄

@ramonjd

ramonjd commented Oct 26, 2026

Copy link
Copy Markdown
Member Author

We might then even make it possible for plugins to de-register or filter panels/sidebars that they don't want folks to see or use. I.e. a cropper that is just cropping but no details tab

This is a good idea! Thanks!

@ramonjd
ramonjd force-pushed the add/media-editor-panel-registry branch from 3f7a1ac to ce4f739 Compare November 27, 2026 05:36
@ramonjd
ramonjd force-pushed the add/media-editor-panel-registry branch from ce4f739 to fe9605d Compare November 27, 2026 05:42
@ramonjd
ramonjd changed the base branch from trunk to fix/plugin-area-hook-namespace November 27, 2026 05:42
@github-actions github-actions Bot removed the [Package] Plugins /packages/plugins label Nov 27, 2026
@ramonjd
ramonjd requested a balanced review from Copilot November 27, 2026 05:43
@ramonjd
ramonjd force-pushed the add/media-editor-panel-registry branch from fe9605d to 9119aef Compare November 27, 2026 05:49
React 19 takes inert as a boolean, but React 18 ignores a boolean and
needs the string 'true'. inertValue returns whichever the running
version renders, and the repo's other inert call sites already use it.
Add @wordpress/react-inert-value as a dependency.
Trunk's `defaultPanel` prop names panels by id, and this branch renames
the ids to `core/crop` and `core/details`. The modal still asked for
`crop`, which no tab has, so it opened on Details. Update the modal, the
prop's documented default and the test, and note that the default panel
is listed first whatever its `order`.
@ramonjd
ramonjd force-pushed the add/media-editor-panel-registry branch from 823b3aa to a9ff47b Compare December 1, 2026 02:53
The boundary took the thrown value as its sign that the panel had
failed. A panel that threw `null` left that value falsy, so the boundary
rendered the panel again, and the second throw went to the next boundary
up. For a plugin's panel that removed the whole plugin, its other panels
included. Track the failure in its own `hasError` flag.
Drop comments that restate the code or describe this change, and the
ones that say a plugin renders a panel, which nothing exported makes
possible yet. Keep the reasons a reader could not work out from the
code.
They name each prop without describing it, and the lint does not ask
for them in these files.
* Keeps a panel's failure inside its tab, so the canvas, the other tabs and
* saving stay usable and the tab names the panel that failed.
*/
export default class MediaEditorPanelErrorBoundary extends Component<

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

TL;DR The error boundary stops a broken panel from taking out the rest of the sidebar with it.

It repeated `mediaType === 'image'`, and nothing read it.

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.

🟢 Approval recommended

The private sidebar extension changes have no active review issues.

No open issues 🎉

Review effort: Balanced

@ramonjd
ramonjd marked this pull request as ready for review December 1, 2026 04:10
@oandregal

oandregal commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Extensions such as filters or an AI tool (WordPress/ai#325) have nowhere to go in the media editor.

This makes me wonder how much we can leverage the PHP-driven actions/fields APIs here (or if at all?). We just updated the AI plugin in the 7.2 cycle to make use of this API to, for example, update the excerpt in the inspector.

@ramonjd

ramonjd commented Dec 2, 2026 •

Copy link
Copy Markdown
Member Author

This makes me wonder how much we can leverage the PHP-driven actions/fields APIs here (or if at all?). We just updated the AI plugin in the 7.2 cycle to make use of this API to, for example, WordPress/ai#1244.

Thank you for raising this @oandregal!!

I suspect there's little scope to leverage those APIs right now.

If I understand things correctly, the fields APIs deal with record data, and, for now, the goal is to get the panels to work on unsaved canvas states (pixels and crop states for example).

Not to say that we shouldn't let third parties define custom fields from within extensions, but how that interacts with the attachment record and the existing details panel would need some chin scratching 😄

But! I think there's a lot we can learn from the patterns, e.g., registering actions/panels.

Once the public API settles here, it's something I'd be interested to look into.

Did I answer your question? 😅

@andrewserong andrewserong 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.

Nice progress, this is looking pretty close to me, and it's smoke-testing well (including the default panel behaviour).

Just left a few comments, some nit-picky, but the main questions I had were about the scope/shape of the panels API (i.e. if we need order at this stage) and the useMediaEditorPanelContext hook and which data we will or won't need / want to expose.

What do you reckon?

// Rebuilt each render, like the elements it replaces: consumers re-render
// as they always did, but the cluster component types stay stable.
const contextValue: MediaEditorFrameContextValue = {
isImage,

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.

Just a note for a follow-up: if we're passing in mediaType, we can likely remove isImage (I think the route version uses it, so better as a follow-up)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good call. I'll do this in a separate refactor follow up

Tabs now follow the order their panels mount, with Core's first, and
the editor still moves its default panel to the front. Only Core's two
panels set an order.
Use the editor crash screen's description, which says what the user can
do. The old line promised the rest of the editor kept working, which the
notice cannot know.
A raw error message means little to the person looking at a broken tab,
so the notice no longer prints or announces it. The button copies the
message and the stack for a bug report, as the editor crash screen does.
Only Core's Crop panel read it, and only for the three aspect-ratio
values `useCropOptions` already returns, so Crop calls that again. What
panels from outside Core get is left for the change that exports them.

@andrewserong andrewserong 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.

Thanks for the updates, this is looking great to me!

Left a couple more nit-picky comments, and whether the de-duping can be simplified a little. Nothing blocking as it's just internal behaviour, and this is mostly just me jotting down notes while I read through the code.

All smoke-testing well for me, thanks again for the back-and-forth. LGTM! 🚀

An object thrown without a message was copied as "[object Object]", and
`null` as "null". Copy "An unknown error occurred." in those cases, as
the editor crash screen does.
The comment named the dependency before the case it is for, and a
reviewer could not tell what it described.
The error also told people to call `registerPlugin`, for a component
nothing exports yet.
@ramonjd

ramonjd commented Dec 2, 2026

Copy link
Copy Markdown
Member Author

Thanks for the help to land this @andrewserong I'll merge and start on the follow ups

@ramonjd
ramonjd merged commit 2bae8d5 into trunk Dec 2, 2026
94 checks passed
@ramonjd
ramonjd deleted the add/media-editor-panel-registry branch December 2, 2026 06:17
@github-actions github-actions Bot added this to the Gutenberg 24.6 milestone Dec 2, 2026
@ramonjd

ramonjd commented Dec 3, 2026

Copy link
Copy Markdown
Member Author

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

Labels

[Feature] Media Anything that impacts the experience of managing media [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants