Skip to content

fix(blocks): bump apiVersion to 3 and harden editor DOM for WP 7.0 - #2668

Open
faisalahammad wants to merge 1 commit into
godaddy-wordpress:masterfrom
faisalahammad:fix/2660-wp7-compat
Open

fix(blocks): bump apiVersion to 3 and harden editor DOM for WP 7.0#2668
faisalahammad wants to merge 1 commit into
godaddy-wordpress:masterfrom
faisalahammad:fix/2660-wp7-compat

Conversation

@faisalahammad

Copy link
Copy Markdown

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:

  • apiVersion: 3 on 56 block.json files (6 bumped from v2, 51 added where apiVersion was absent)
  • Hero block edit.js: replaced document.getElementById('block-'+clientId) (6 sites) and document.defaultView (2 sites) with useRef + blockRef.current.getElementsByClassName
  • CI: test-wp-next.yml targets WP 7.0 final release
  • readme.txt + package.json: tested_up_to 6.8 -> 7.0
  • Refreshed save snapshots for apiVersion-3 markup changes

Screenshots

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 passed
  • yarn build: webpack compiles without errors
  • Lint: pre-existing ESLint config issue (extends wordpress from parent directory) — unrelated to PR changes

Acceptance criteria

WP 7.0 compatibility — blocks register with apiVersion: 3, editor DOM queries work inside iframe, CI targets correct WP version.

Checklist:

  • My code is tested
  • My code follows accessibility standards
  • My code has proper inline documentation
  • I've included any necessary tests
  • I've included developer documentation
  • I've added proper labels to this pull request

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WordPress 7.0 Compatibility Review

1 participant