Skip to content

Keep Core's cover padding off stylesheet-painted sources - #6146

Merged
chubes4 merged 1 commit into
trunkfrom
fix/cover-default-padding
Nov 15, 2026
Merged

chubes4 merged 1 commit into
trunkfrom
fix/cover-default-padding

Conversation

@chubes4

@chubes4 chubes4 commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Problem

A stylesheet-painted hero becomes a core/cover, and Core gives .wp-block-cover padding: 1em. The source box has no padding of its own, so any side the author stylesheet leaves unset picks up Core's 1em. On a real Webflow import, a contact section declared only padding-top: 0; padding-bottom: 150px, so 14 px leaked in on each side and both columns lost 14 px of width (636 px instead of 650 px).

The flex/grid and auto-height branches of CoverPattern already zero the padding inline. A plain block-display hero with a min-height takes neither branch.

Change

EngineSupportCss::coreDefaultResetCss() adds :root :where(.wp-block-cover.blocks-engine-cover-consumed-background){padding:0} next to the other core-default resets. It is emitted before the author CSS at single-class weight, so it beats Core's rule and every authored padding still wins. With author cascade layers it uses the existing revert-layer bridge.

Evidence

tests/unit/cover-default-padding-browser.mjs runs the real transformer, then renders the output with WordPress's block-library/style.min.css in WordPress's load order. It checks the computed padding and the content box against the source, table-driven over an author who sets only top/bottom and one who sets all four sides.

top/bottom-only author padding
trunk 0 16px 150px 16px, content 1408 px wide ✗
this PR 0 0 150px 0, content 1440 px ✓ (matches source)

Gates run locally (Lab runner unavailable):

  • composer test:parity: 357/357.
  • engine-support-css, engine-support-css-asset and cover-pattern unit tests pass.
  • Topology shards 1/2/4 match the baseline.
  • Shard 3 shows only the 30-cursed-pangolin-fanwiki divergence that trunk also shows in this PHP 8.5 environment.
  • composer test:scripts: 1546/1549. The three Chrome contracts (artwork-slideshow, component-interactions, positioned-carousel-stage) fail on trunk locally too.

AI disclosure: Franklin (Claude, via the Pi coding agent) traced the gap on a live import with CDP matched-style inspection, wrote the change and the browser regression test, and ran the gates.

@chubes4
chubes4 merged commit 83b10cf into trunk Nov 15, 2026
14 checks passed
@chubes4
chubes4 deleted the fix/cover-default-padding branch November 15, 2026 17:33
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