fix(blocks): bump apiVersion to 3 and harden editor DOM for WP 7.0 - #2668
Open
faisalahammad wants to merge 1 commit into
Open
fix(blocks): bump apiVersion to 3 and harden editor DOM for WP 7.0#2668faisalahammad wants to merge 1 commit into
faisalahammad wants to merge 1 commit into
Conversation
WordPress 7.0 always runs the editor in an iframe and deprecates Block API v1/v2. This migrates all 56 active block.json files to apiVersion: 3 (6 bumped from v2, 51 added where missing) and removes top-level document/window access from the hero block editor by switching to a useRef + same-document query. Other editor DOM access (icon, posts, post-carousel, row/column, testimonials) is same-document scoped and works inside the iframe; annotated with ponytail comments. Also: - CI: test-wp-next.yml now targets WP 7.0 final (release date + URL) - readme.txt + package.json: tested_up_to 6.8 -> 7.0 - Save snapshots regenerated for apiVersion-3 markup changes Fixes godaddy-wordpress#2660
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.
Description
Fixes #2660
Migrate 56 active block.json files to apiVersion: 3 for WordPress 7.0 compatibility. The editor now always runs in an iframe — replaces top-level document/window calls in the hero block editor with a useRef-based approach. Annotates other same-document DOM access as safe with ponytail comments.
Changes:
document.getElementById('block-'+clientId)(6 sites) anddocument.defaultView(2 sites) withuseRef+blockRef.current.getElementsByClassNameScreenshots
N/A — no UI changes.
Types of changes
Bug fix (non-breaking change which fixes an issue)
How has this been tested?
yarn test:js: 573 passed, 1 skipped, 341 snapshots passedyarn build: webpack compiles without errorsAcceptance criteria
WP 7.0 compatibility — blocks register with apiVersion: 3, editor DOM queries work inside iframe, CI targets correct WP version.
Checklist: