Repository navigation
Fixed rendering of block charts inside editor iframe - #1417
Open
girishpanchal30 wants to merge 2 commits into
Open
girishpanchal30 wants to merge 2 commits into
girishpanchal30 wants to merge 2 commits into
Conversation
Contributor
pirate-bot
requested changes
Nov 24, 2026
Contributor
There was a problem hiding this comment.
🟡 Changes requested
Charts now draw in the iframed editor, but table charts there lose DataTables Responsive, so fix the extension start-up before merge.
Validation details
- Files reviewed: 8/8 changed files. One history question stayed open: code that assumes one editor document and one mounted ref, as in the widgets screen and Customizer.
- WordPress 7.1.5 sandbox, HEAD build: the Google chart editor test passes at HEAD [R14] and fails at pr-base [R17].
- The DataTable editor test passes at HEAD [R15].
- A probe shows Responsive missing in the editor canvas and present on the front end [R35].
- The new Jest file passes at HEAD [R4]. Against pr-base, one case fails and one passes [R5].
- Security pass on the changed hunks found no issue.
Untested areas
- The DataTable editor test at pr-base was inconclusive. A setup break stopped it before the canvas step [R18].
- Widgets screen and Customizer hosts (one editor document and one mounted ref) were not run.
- Chart redraw after a canvas-only resize, such as device preview, was not run.
- FixedHeader in the canvas was checked from source only.
- The variant pass did not settle these places, where the fixed cause may still reach:
classes/Visualizer/Gutenberg/src/Components/GoogleChart.js:30-40— unverified: The wrapper supplies a DOM reference, but whether every draw, lookup and measurement honors it belongs to C7’s react-google-charts 3.0.15 dependency check; handed off without resea…classes/Visualizer/Gutenberg/src/Editor.js:152-163— unverified: Media callbacks target the outer window. WordPress 5.2 and 7.1 mount media modals in the outer body (/deps/wordpress/5.2/wp-includes/js/media-views.js:4319-4351; /deps/wordpress/7.…Components/ChartSelect.js:178-195— unverified: Media callbacks target the outer window. WordPress 5.2 and 7.1 mount media modals in the outer body (/deps/wordpress/5.2/wp-includes/js/media-views.js:4319-4351; /deps/wordpress/7.…classes/Visualizer/Gutenberg/src/Components/ChartSelect.js:178-195— unverified: Same modal placement evidence at WordPress 5.2 and 7.1; classes/Visualizer/Render/Page/Send.php:46-48 calls the popup’s parent callback. Other supported versions remain unchecked.node_modules/react-google-charts/dist/index.esm.js:395-410— unverified: Version 3.0.15 subscribes redraw exclusively to the outer window.resize. An iframe-only viewport resize misses that subscription. Whether an ordinary editor canvas resize leaves a …js/elementor-widget-preview.js:155-179— unverified: Observation and initial scanning use the global document, while the Elementor hook accepts an externally supplied scope. Whether that scope can belong to another document depends o…
🤖 Automated review · run code-review-agent_6b055f9cc5dda8.12256733.
🤖 Review agent — review posted ✅ on 1b8813b5 · changes requested · 2 findings · 28 min
Run code-review-agent_6b055f9cc5dda8.12256733 · trail
pirate-bot
approved these changes
Nov 24, 2026
Contributor
There was a problem hiding this comment.
🟢 Approved
The PR passes: DataTables Responsive now starts in the iframed editor, and the redundant Jest case is gone.
Validation details
- Files reviewed: 8/8 changed files.
- WordPress 7.1 sandbox, HEAD build: the DataTable editor test gives
cd /repo && set -o pipefail; WP_ENV_TESTS_PORT=8080 WP_USERNAME=admin WP_PASSWORD=admin WP_ARTIFACTS_PATH=/workspace/che…printed1 passed(run R5). - With the earlier
DataTable.js, the same test givescp -a /workspace/checks/C1/copy/classes/Visualizer/Gutenberg/build/. /repo/classes/Visualizer/Gutenberg/build/ && cmp /r…printed1 failed(run R7) ontd.dtr-control. - Canvas probe at 420px:
cd /workspace; wp post meta update 27 visualizer-chart-library DataTable 2>&1|tail -1; wp post meta update 28 visualizer…printed"tableClass":"dataTable dtr-inline collapsed"(run R14). The earlierDataTable.jsgivescp -a /workspace/checks/C1/copy/classes/Visualizer/Gutenberg/build/. /repo/classes/Visualizer/Gutenberg/build/ && cd /wo…printed"settingsResponsive":"undefined"(run R15). - Responsive 3.0.8 source: a start after init still sizes columns. The front end skips a second start.
- Security pass on the changed hunks found no issue.
Untested areas
- Keyboard Enter on a collapsed row and keyboard paging in the canvas were not settled. The editor took focus from the table.
- Freeze Header does not apply in the canvas. The library cannot target the iframe.
- The front-end table did not render in this sandbox. The diff does not change the front-end renderer.
- Device preview, media callbacks on other WordPress versions, Elementor, widgets and Customizer were not run.
- The variant pass did not settle these places, where the fixed cause may still reach:
node_modules/react-google-charts/dist/index.esm.js:395-410— unverified: react-google-charts 3.0.15 redraws through outer window.addEventListener("resize", this.onResize). Still missing: a source-supported editor action that changes only the iframe view…classes/Visualizer/Gutenberg/src/Components/ChartSelect.js:178-195— unverified: outer send_to_editor matches outer-mounted media modals in WordPress 5.2 and 7.1 (/deps/wordpress/5.2/wp-includes/js/media-views.js:4319-4351; /deps/wordpress/7.1/wp-includes/js/me…classes/Visualizer/Gutenberg/src/Editor.js:152-163— unverified: the same modal-location evidence applies; js/preview.js:137-141 posts the chart ID to its parent. The complete media-iframe nesting across other supported WordPress versions remain…js/elementor-widget-preview.js:155-179— unverified: prior ruling retained: document observation and window event subscription remain outer-global; the installed Elementor version and its script/document placement were not establishe…js/lib/datatables.min.js:16— unverified: without ResizeObserver, resizing falls back to H(W).on("resize.DT-"+t.sInstance,D), using the outer window. Missing fact: whether a supported browser reaches this fallback.- not reached: bulk bundled-library AST output, including js/lib/chartjs.min.js, truncated during the initial search
🤖 Automated review · run code-review-agent_6b056a54c573b5.39898505.
🤖 Review agent — review posted ✅ on 127676be · approved · 0 findings · 28 min
Run code-review-agent_6b056a54c573b5.39898505 · trail
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.
Summary
Improved chart rendering in alternative DOM contexts, including iframed block editor canvases, by ensuring D3 and Google Charts resolve containers from the correct document. Refactored DOM access to use React refs, scoped event and message handling to the appropriate window, and introduced a dedicated Google Charts wrapper to ensure reliable container resolution.
Will affect visual aspect of the product
NO
Check before Pull Request is ready:
Closes #1413