Skip to content

fix(php-transformer): keep responsive variant chrome out of a second header - #2241

Merged
chubes4 merged 1 commit into
trunkfrom
fix/single-header-responsive-variants
Sep 26, 2026
Merged

chubes4 merged 1 commit into
trunkfrom
fix/single-header-responsive-variants

Conversation

@chubes4

@chubes4 chubes4 commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Problem

Inner pages rendered the site header twice at desktop width: the template bound a header part, and the page content still contained a second header landmark inside the desktop document variant. The extra chrome pushed the first navigation link and the rest of the page down.

Root cause

Responsive document variants often do not share one landmark identity, so inlineSharedShells() cannot replace both copies. sharedShells() still extracted the variant it recognized as shared chrome, bound that part on the page template, and left the other variant's landmark in post_content. A template part is visible at every viewport, so the rendered page had both.

Fix

Before a shared shell is committed, refuse extraction when a responsive document variant still contains a site-level landmark for that area. Identical chrome across variants is still hoisted, because every copy is removed and the check does not fire. Divergent variants stay page-owned inside their visibility-gated documents, so the template does not add a second header.

Regression test

php tests/contract/shared-shell-plan.php

Fails before:

Fatal error: Uncaught RuntimeException: index.html must not bind a header part while page content still carries a header landmark.
UNFIXED_EXIT:255

Passes after:

shared-shell-plan contract passed
FIXED_EXIT:0

Also passed: wordpress-site-plan, viewport-hidden-document-variants, entry-point-transform-parity.

Verification

Fresh import with Static Site Importer origin/main @ 6f0eff4 packaged against this commit. Four inner routes at 1440:

headers header height first nav Y
source 1 122 45
baseline 2 163 208
this fix 1 124 45

At 390 the desktop document is display:none, the mobile document is display:contents, and exactly one header landmark is visible.

Fixes #2237

AI disclosure: implemented by xAI Grok 4.7 via OpenCode (opencode run), orchestrated and reviewed by Claude (Anthropic).

…header

A shared template part is visible on every viewport. Binding it while a
responsive document still contains that landmark rendered the header twice.
Leave those landmarks page-owned unless every copy can be hoisted.
@chubes4
chubes4 marked this pull request as ready for review September 26, 2026 01:01
@chubes4
chubes4 merged commit 139f64e into trunk Sep 26, 2026
10 checks passed
@chubes4
chubes4 deleted the fix/single-header-responsive-variants branch September 26, 2026 01:02
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.

Inner pages render the header twice: template part plus the responsive document's inline header

1 participant