Pad main in scaffolded themes so WooCommerce default templates clear the header and footer - #4781
Merged
Merged
Conversation
…the header and footer Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Collaborator
📊 Performance Test ResultsComparing d82dce5 vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issues
How AI was used in this PR
Claude Code diagnosed the issue on two agent-built shop sites (measured the rendered gaps in a browser), proposed the fix, and applied it. The selector was corrected after live-testing against WooCommerce's single-product template. Reviewed by the author.
Proposed Changes
Shops built by Studio Code render the WooCommerce pages (shop, product, cart, checkout, my account) with no vertical space between the header and the content, and between the content and the footer, while the site's own pages look right.
The cause is a contract the scaffolded theme sets up but only half honours.
scaffold_themezeroes WordPress's root block gap (.wp-site-blocks > * + *) so full-bleed sections can butt edge to edge, and agent-authored pages carry their own padding. WooCommerce's default block templates render a baremainand rely on that root gap for breathing room, so they collapse against the header and footer. The agent has been patching this per page with body-class rules during polish, and on one site it wrote its ownarchive-product.htmlwithout header or footer parts.This PR keeps WooCommerce's default templates in play and fixes the theme side instead:
style.csspairs the root-gap reset with vertical padding onmain, using the theme's spacing presets. Any template the theme does not author (WooCommerce today, other plugins tomorrow) gets its space back with no plugin-specific rules. Thepage-no-titletemplate opts out with anis-flushclass, since its full-bleed sections own the rhythm.plugin-recommendationsskill tells the agent to rely on WooCommerce's default templates when possible and to keep header and footer parts if it ever does override one.block-contentandvisual-polishskills get one-clause additions: keep both rules together, and check the space aroundmainon Woo pages.User impact: newly scaffolded shop sites get consistent spacing on every WooCommerce page without per-page hacks. Existing sites are unchanged.
Testing Instructions
npm test -- apps/cli/ai/tests/tools.test.ts -t scaffoldscaffold_theme, WooCommerce installed) and open Shop, a product, Cart and Checkout. The content should sit clear of the header and footer on each page. A page assigned the "Page (no title)" template should still start flush under the header.Pre-merge Checklist
🤖 Generated with Claude Code