Repository navigation
Conversation
The editor canvas is an iframe since WordPress 7.0. The Tabs block looked up
its elements in the global document, so selecting or adding a tab threw
"Cannot read properties of null" and the block crashed.
- Look elements up through a ref and its owner document.
- Move both blocks to block API version 3 with useBlockProps.
- Declare the inner blocks template in the block type settings, which
WordPress 7.2 expects, and only pass the deprecated template props of
InnerBlocks to older versions.
- Keep the front end only tab header rules out of the editor canvas and
apply the editor only stats rule inside it, the canvas body has no
.wp-admin class.
- Use SVG icons for the add buttons, Dashicons are not loaded in the canvas.
- Enqueue the block editor scripts on enqueue_block_editor_assets so the
front end no longer loads the block editor packages, and the editor
styles on enqueue_block_assets so they reach the canvas without the
"added to the iframe incorrectly" warning.
- Replace defaultProps with default parameters and the deprecated
${var} string interpolation with {$var}.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014Vk5tbL8H5R4CvX8gDi8CN
The pattern image is a plugin asset, attachment 17 either does not exist, which makes the editor request it and get a 404, or is an unrelated image. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014Vk5tbL8H5R4CvX8gDi8CN
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014Vk5tbL8H5R4CvX8gDi8CN
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014Vk5tbL8H5R4CvX8gDi8CN
The paragraph align attribute is deprecated since WordPress 7.0 and logged a deprecation notice in the editor for every pattern. The rendered markup is unchanged. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014Vk5tbL8H5R4CvX8gDi8CN
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.
Requested by JP · project thread
Description of the Change
Makes the plugin work on WordPress 7.2 (tested on 7.2-RC3), bumps "Tested up to" to 7.2 and bumps the WordPress minimum from 6.6 to 7.0.
Tabs block crash (reported in #244, still reproduces on 7.1 and 7.2). The editor canvas is an iframe since WordPress 7.0.
tenup/tabslooked its elements up in the globaldocument, so selecting or adding a tab threwCannot read properties of null (reading 'setAttribute' / 'classList')and the block showed "This block has encountered an error and cannot be previewed".tenup/tabsandtenup/tabs-itemto block API version 3 withuseBlockProps(removes the "Block with API version 2 or lower is deprecated" warning). Saved markup is unchanged.body:not(.wp-admin) …) out of the canvas and apply the editor only stats rule inside it. The canvas body has no.wp-adminclass, which had the title squeezed beside the tabs and the editable tab header misplaced.New in WordPress 7.2. The
templateandtemplateInsertUpdatesSelectionprops ofInnerBlocksare deprecated in favour of declaring them in the block type settings. The template is now declared in the settings, and the props are only passed on WordPress versions before 7.2.Other warnings found while testing
enqueue_block_assets, so every front end page loaded React and the block editor packages (51 scripts on the Media Kit page, 6 after this change). They now load onenqueue_block_editor_assets.enqueue_block_assetsinstead ofadmin_enqueue_scripts, which removes "publisher_media_kit_admin-css was added to the iframe incorrectly".defaultPropsonCustomBlockAppenderreplaced with default parameters (React warning).${var}string interpolation inincludes/core.phpreplaced with{$var}(deprecated since PHP 8.2)./wp/v2/media/17and get a 404.Minimum version
style.typography.textAlignfor paragraphs in place of thealignattribute, which logged "align attribute in paragraph block is deprecated since version 7.0". The rendered markup is unchanged.Not changed
tenup/tabswith the core Tabs block, as raised in The plugin hasn't been tested with the latest version of WordPress #244, is left for a separate decision.How to test the Change
Tested by hand and with Playwright on 7.2-RC3, 7.1 and 7.0. The three Cypress specs were replayed with Playwright and pass, Cypress itself was not run locally.
Changelog Entry
Credits
Props @oscarssanchezz, @jeffpaul
Checklist:
Closes #244
https://claude.ai/code/session_014Vk5tbL8H5R4CvX8gDi8CN
Generated by Claude Code