Skip to content

fix(php-transformer): keep positioned media out of media-text - #2968

Merged
chubes4 merged 1 commit into
trunkfrom
fix/issue-2955-blocks-engine
Oct 16, 2026
Merged

chubes4 merged 1 commit into
trunkfrom
fix/issue-2955-blocks-engine

Conversation

@chubes4

@chubes4 chubes4 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #2955

Root cause

MediaTextPattern::match() accepted any two-column section whose media child holds an image, including a hero whose <figure> is position:absolute; inset:0 behind the copy. core/media-text lays both children out side by side, so the cover image became a full-width in-flow column (1440×900 instead of the source's 613×592 at x=827) and pushed the copy down.

The fix: once the media style is resolved, the pattern declines when the media's position is absolute or fixed, or cannot be resolved. The element then follows the normal group path, which keeps the author's positioning.

Tests

  • tests/unit/media-text-pattern.php: new cases for absolutely positioned media, fixed media, and unchanged in-flow media. The positioned cases fail on trunk and pass with the fix.
  • Full composer validate --strict && composer test passes locally.

AI disclosure: Claude Opus via Pi coding agent (Homeboy cook + Roadie). A Homeboy cook first patched the TypeScript converter, which the PHP import path does not use. The orchestrating agent discarded that change, wrote this PHP fix and its tests, and ran the full suite. Chris Huber directed the work.

@chubes4
chubes4 force-pushed the fix/issue-2955-blocks-engine branch from 4f6f6fe to becb94a Compare October 16, 2026 21:53
@chubes4 chubes4 changed the title Fix Automattic/blocks-engine#2955 fix(php-transformer): keep positioned media out of media-text Oct 16, 2026
@chubes4
chubes4 merged commit 7be19ed into trunk Oct 16, 2026
15 checks passed
@chubes4
chubes4 deleted the fix/issue-2955-blocks-engine branch October 16, 2026 22:26
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.

Media & Text loses the media wrapper's containing block: absolute cover image escapes to viewport size

1 participant