Skip to content

Refine text-wrapper collapse: ignore zero-reset box values and flex layout (#630)#685

Merged
chubes4 merged 1 commit into
trunkfrom
fix/630-eyebrow-zero-reset-collapse
Jul 23, 2026
Merged

Refine text-wrapper collapse: ignore zero-reset box values and flex layout (#630)#685
chubes4 merged 1 commit into
trunkfrom
fix/630-eyebrow-zero-reset-collapse

Conversation

@chubes4

@chubes4 chubes4 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #684. That change collapsed typography-only text wrappers to styled paragraphs, but on real imported sites the eyebrow still round-tripped as a core/group because two signals wrongly counted as box-model geometry:

  1. Universal reset. Most sites ship * , *::before, *::after { margin: 0; padding: 0 }, which sets a zero-valued padding on every element. The collapse gate treated any present padding as box chrome, so every wrapper looked disqualified.
  2. Flex layout. display:inline-flex / gap was treated as disqualifying, but a childless text leaf has no flex items — its flex layout only aligns a ::before decoration (e.g. an eyebrow's leading dash), which the wrapper class still applies to a paragraph.

Fix

  • The collapse now disqualifies only real box chrome (padding / border / explicit sizing) whose value is non-zero, via a new cssValueIsNonZero() helper (treats 0, 0px, 0 0 0 0, none, empty as no geometry).
  • Flex layout properties (display, gap) are dropped from the collapse-blocking set. Real flex containers carry child elements and are already excluded by the existing childElementCount === 0 guard (e.g. .tier-price wrapping a <span> stays a group).

Verification

End-to-end through the SSI fixture matrix (WP 7.0.2, 3-artist-music): the merch eyebrow now compiles and renders as a single styled paragraph in the sandbox — <p class="label pl pl-d1 wp-block-paragraph"> instead of div.wp-block-group label wrapping a default paragraph — and the /contact/ route visual mismatch dropped from 13.42% to 11.52%.

Full php-transformer suite green: 248 parity fixtures, 77 block-style-support tests (adds a universal-reset eyebrow regression: 29b/29c), all contracts.

AI assistance disclosure

Drafted with Claude (Sonnet 4.5) via opencode, used to trace the in-sandbox compile path, isolate the universal-reset padding:0 false positive via DOM/declaration introspection, and implement the zero-value guard. Every line reviewed by Chris Huber.

Refs #630.

…ayout

The initial typography-only collapse still left real eyebrows as groups on
imported sites, because two signals wrongly counted as box-model geometry:

1. A universal reset (`* { margin: 0; padding: 0 }`) sets zero-valued padding
   on every element, so every wrapper looked like it owned box chrome.
2. `display:inline-flex`/`gap` was treated as disqualifying even though a
   childless text leaf has no flex items — its flex layout only aligns a
   `::before` decoration, which the wrapper class still applies to a paragraph.

The collapse now disqualifies only real box chrome (padding/border/explicit
sizing) with non-zero values, via cssValueIsNonZero(), and drops flex layout
from the blocking set (real flex containers carry child elements and are
already excluded by the childElementCount === 0 guard). This makes
`<div class="label">The Shop</div>` under a zero reset collapse to a single
styled paragraph, resolving the ~21px eyebrow offset on imported artist-site
routes, while box-chrome wrappers (`.tag`, `.use-case-result`) stay groups.

Full php-transformer suite green: 248 parity fixtures, 77 block-style-support
tests (adds a universal-reset eyebrow regression), all contracts.

Refs #630.
@chubes4
chubes4 merged commit 8ad978f into trunk Jul 23, 2026
4 checks passed
@chubes4
chubes4 deleted the fix/630-eyebrow-zero-reset-collapse branch July 23, 2026 13:24
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.

1 participant