Automattic / Automattic/blocks-engine

Preserve positioned image collages during gallery conversion

Open
#668 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
14
Forks
2
Avg merge
2h 10m
Merged PRs (30d)
561

Description

## Problem

The HTML-to-blocks transformer promotes any container with two or more direct media children to `core/gallery`. That is unsafe for authored collages whose children rely on absolute positioning, overlap, z-index, clipping, or custom crop offsets. Gutenberg gallery layout rewrites those children into equal columns and destroys the composition.

## Evidence

Fisiostetic node `21:115` is a positioned two-image collage:

- container: `position: relative`, `overflow: hidden`, `isolation: isolate`, fixed height `566.123px`
- children: absolute positioning, z-index, custom dimensions/crop offsets, and overlap
- source first image: approximately `289 x 312px` inside the authored collage
- candidate after `core/gallery` promotion: approximately `200 x 566px` as a full-height gallery column
- mismatch region: `x=24, y=2670, 289 x 566`, 135,833 pixels (16.2% of the repaired Fisiostetic diff)

Source/candidate images are fully loaded; this is structural conversion loss.

## Expected

Gallery promotion uses a semantic safety predicate. Containers with positioned, overlapping, clipped, z-indexed, or custom-offset media remain a generic native container with native `core/image` children. Ordinary gallery-compatible sibling media continue to become `core/gallery`.

## Acceptance

- deterministic contract coverage for ordinary galleries and positioned collages
- zero `core/html` fallback for the collage case
- Fisiostetic collage preserves authored child geometry instead of gallery columns
- focused browser parity improves from the repaired 11.90% baseline

## AI assistance

- **AI assistance:** Yes
- **Tool:** OpenAI GPT-5.6 Sol via OpenCode
- **Used for:** Repaired visual-diff analysis and generic ownership classification.

Contributor guide

Open the contributing guide

Research direction

Start at the HTML-to-blocks transformer and the path that promotes containers with multiple media children to core/gallery. Use the Fisiostetic node 21:115 collage as the reproduction, alongside an ordinary gallery, and inspect the deterministic contract and focused browser-parity results. Done means positioned collage geometry is preserved with native core/image children, ordinary galleries still promote, and no core/html fallback occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.