Repository navigation
Conversation
The classic meta boxes now render in two iframes loading the classic edit screen through the meta box loader URL: one in the bottom pane for the normal and advanced locations, one in the settings sidebar for the side location. The loader page trims the screen down to the meta boxes, sends the same Document-Isolation-Policy header as the editor, and rewrites dimension media queries so styles respond to the editor window instead of the iframe. Saving dispatches a submit event in each iframe so submit handlers and TinyMCE write their values, then collects the fields with the browser's form serialization. The editor page no longer renders the meta boxes at all. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Size Change: -1.35 kB (-0.02%) Total Size: 7.92 MB 📦 View Changed
|
The loader changes how meta boxes render unconditionally, with no experiment toggle, so it is core bound code and belongs in lib/compat/wordpress-7.0, not lib/experimental. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The plugin is only used by the new end-to-end tests, so it belongs in the same change as those tests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The Preferences modal checkboxes no longer toggle a block editor panel
preference. They save to the metaboxhidden_{screen} user option over
the same admin-ajax action the classic Screen Options use, so both
editors share one visibility setting and the loader page renders the
boxes hidden on the server. The listing dispatched to the editor now
carries each box's hidden state, and the injected visibility style
sheet is replaced by a sync of the rendered boxes with the store.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The require was left behind when the file moved out of experimental. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This reverts commit 83bd723.
A memoized private selector returns the hidden meta box ids as a stable array, the iframe tracks its document through the load event, and an effect toggles the hide-if-js class the admin styles already hide boxes with, instead of building a style sheet. Toggling the class both ways also stops the classic Screen Options hidden state from applying inside the iframes, which the block editor ignores. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The script that adapts the classic screen to the iframe now lives in meta-box-iframe.js, printed inline by the PHP so that it is not a registered script anything can depend on. It also applies the editor's meta box visibility preferences itself: a style built from the parent's preferences hides boxes before first paint, and the boxes follow later changes through a parent store subscription, so the editor side needs no code for it. The classic Screen Options hidden state no longer applies inside the iframes, which matches how the block editor treats it. The save flow finds the iframes by their frame names through the elements; the browsing context names are cleared under the editor's Document-Isolation-Policy, so window.frames cannot resolve them. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
It is the only caller, so the lookup does not need to be a utility. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The form submits as if a button were pressed: a real, trusted submit event with a submitter. The loader page cancels every submission at the capture phase, which no meta box handler can prevent, so the form never navigates, and the temporary submitter skips constraint validation, which would otherwise silently abort on invalid fields inside hidden meta boxes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The loader page renders the hidden submit button at the top of the post form instead of the save flow creating a temporary one, so submitting the form is a plain requestSubmit call, and pressing Enter in a field uses the same submitter. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The save flow skips documents without the post form, still loading or failed, in one place instead of each step guarding on its own. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The fields are collected right after each form is submitted, with the form reached through the submit button, and a document is skipped when the button is missing because the page is still loading or failed to load. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Flaky tests detected in 0f95851. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/33226908617 passes the search value in the main inserter when clicking `Browse all` in
|
The loader now renders a bare admin iframe document with only the post form and the requested meta boxes, using the same core functions the classic edit screen is built from, instead of loading the full classic screen and hiding most of it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The screen flag makes do_meta_boxes() skip the boxes the block editor replaces, so the removal pass is no longer needed, and the poststuff wrapper from the block editor page restores the admin postbox styles. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The block editor page no longer renders the boxes, so instead of re-sending the listing core computes from a footer script, each iframe reports the boxes in its own document to the editor's store. The iframes stay mounted while hidden, since their documents are now the source of that listing. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A modal opened inside an iframe cannot render outside of it, so the loader script watches its document for one, a fixed element covering the viewport, and the frame grows to cover the whole editor while it is open. The stacking contexts between the frame and the page are flattened for the frame's level to decide, and the pane's shadow moves from a filter to a box-shadow since a filter would confine the frame. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ellatrix
force-pushed
the
try/render-meta-boxes-in-iframes
branch
from
August 31, 2026 19:18
2454011 to
4ef214b
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Renders classic meta boxes in iframes that load the classic edit screen, instead of moving server rendered markup into the editor page. This is the rendering swap only. Refreshing the boxes on revision restore builds on top of it in a follow up.
Why?
Classic meta boxes are PHP rendered snapshots that the editor moves around its own DOM and cannot re-render. An iframe gives them a real classic document of their own: classic scripts run natively with no deferred initialization, their markup and styles cannot collide with the editor, and the document can be loaded again at any time, which gives features like revision restore and collaboration a way to bring the boxes up to date.
How?
sidelocation, which sizes itself to its content, and one in the bottom pane fornormalandadvanced.@mediaconditions through the CSSOM toallornot allbased onparent.matchMedia(), keeps them updated on window resizes, and wrapswindow.matchMediathe same way. Desktop minimum widths are overridden where the sidebar is narrower than they allow.Document-Isolation-Policy(for client side media processing), and an isolated document cannot script same origin frames that are not isolated the same way. The loader page sends the same header under the same conditions.requestSubmit(), as if a button were pressed, so meta boxes that serialize their values in submit handlers run first (TinyMCE saves its editors from its own submit handler). The loader cancels every submission at the capture phase so the form never navigates, and renders a hiddenformnovalidatesubmit button for the save flow to submit with, which skips constraint validation that would otherwise silently abort on invalid fields inside hidden boxes. The fields inside the meta boxes are then collected with the browser's own form serialization, merged with the base form data, and posted to the meta box loader as before.Known gaps
Testing Instructions
gutenberg-test-plugin-meta-boxtest plugin, or the demo plugin Add end-to-end coverage for TinyMCE and side location meta boxes #82199 adds with a variety of boxes.Testing Instructions for Keyboard
Tab from the editor into the meta box pane and sidebar boxes; fields, postbox toggles, and the move buttons are reachable and operable with the keyboard inside the iframes.
Screenshots or screencast
Use of AI Tools
Written with the assistance of Claude Code, reviewed and tested by hand.