Skip to content

Fix the Tabs block, bump WordPress minimum to 7.0 and "tested up to" to 7.2 - #253

Draft
jeffpaul wants to merge 5 commits into
developfrom
fix/244-wp-7.2-compat
Draft

jeffpaul wants to merge 5 commits into
developfrom
fix/244-wp-7.2-compat

Conversation

@jeffpaul

@jeffpaul jeffpaul commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

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/tabs looked its elements up in the global document, so selecting or adding a tab threw Cannot read properties of null (reading 'setAttribute' / 'classList') and the block showed "This block has encountered an error and cannot be previewed".

  • Look elements up through a ref and its owner document.
  • Move tenup/tabs and tenup/tabs-item to block API version 3 with useBlockProps (removes the "Block with API version 2 or lower is deprecated" warning). Saved markup is unchanged.
  • Keep the front end only tab header rules (body:not(.wp-admin) …) out of the canvas and apply the editor only stats rule inside it. The canvas body has no .wp-admin class, which had the title squeezed beside the tabs and the editable tab header misplaced.
  • Use SVG icons for the "Add New Tab" and "Insert Tab Content" buttons. Dashicons are not loaded in the canvas, so the buttons were blank.

New in WordPress 7.2. The template and templateInsertUpdatesSelection props of InnerBlocks are 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

  • The block editor scripts were enqueued on 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 on enqueue_block_editor_assets.
  • Editor styles are enqueued on enqueue_block_assets instead of admin_enqueue_scripts, which removes "publisher_media_kit_admin-css was added to the iframe incorrectly".
  • defaultProps on CustomBlockAppender replaced with default parameters (React warning).
  • ${var} string interpolation in includes/core.php replaced with {$var} (deprecated since PHP 8.2).
  • Removed the hard-coded attachment ID 17 from the Cover pattern, which made the editor request /wp/v2/media/17 and get a 404.

Minimum version

  • "Requires at least" is now 7.0 in the plugin header and README, and the "WP minimum" Cypress job runs on 7.0.
  • With that, the patterns use style.typography.textAlign for paragraphs in place of the align attribute, which logged "align attribute in paragraph block is deprecated since version 7.0". The rendered markup is unchanged.

Not changed

How to test the Change

  1. On WordPress 7.2, activate the plugin and open the generated "Media Kit" page in the editor.
  2. In "Digital Ad Specs", click each tab, add a tab with the plus button, type a header and content, save and reload. The block should not crash and the console should have no errors from the plugin.
  3. View the page on the front end and switch tabs.
  4. Repeat on the 7.0 minimum.

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

Fixed - Tabs block crash in the block editor on WordPress 7.0 and later.
Fixed - Block editor scripts no longer load on the front end.
Changed - Bump WordPress "tested up to" version 7.2.
Changed - Bump WordPress minimum from 6.6 to 7.0.
Changed - Tabs blocks use block API version 3.

Credits

Props @oscarssanchezz, @jeffpaul

Checklist:

Closes #244

https://claude.ai/code/session_014Vk5tbL8H5R4CvX8gDi8CN


Generated by Claude Code

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
@jeffpaul jeffpaul self-assigned this Dec 1, 2026
@github-actions github-actions Bot added this to the 1.4.0 milestone Dec 1, 2026
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
@jeffpaul jeffpaul changed the title Fix the Tabs block on WordPress 7.0+ and bump "tested up to" to 7.2 Fix the Tabs block, bump WordPress minimum to 7.0 and "tested up to" to 7.2 Dec 1, 2026
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.

The plugin hasn't been tested with the latest version of WordPress

2 participants