Skip to content

Shrink the header on scroll again, without the flicker - #244

Merged
mlaetitia merged 2 commits into
developfrom
fix/header-shrink-without-flicker-develop
Sep 30, 2026
Merged

mlaetitia merged 2 commits into
developfrom
fix/header-shrink-without-flicker-develop

Conversation

@mlaetitia

Copy link
Copy Markdown
Collaborator

Related to #

Proposed changes

  • The header shrinks on scroll again above 1200px: bar 125px to 90px, logo to 60px.
  • It is now fixed to the viewport, with a spacer holding its place, so the page below never moves.
  • Below 1200px nothing changes.

Why are these changes being made?

#241 removed the shrink to stop a flicker. The flicker came from the header sitting in the document flow: shrinking it moved the page, Chrome corrected the scroll position to compensate, and that correction re-triggered the shrink in a loop. Out of the flow there is nothing to correct, so the shrink is safe to have back.

90px is the floor. #243 pinned the logo column at 300px so the menu never reflows, which leaves the menu at two rows below roughly 1690px.

Testing instructions

  • Chrome, above 1200px: scroll down slowly. The bar shrinks once, nothing below it moves, no flicker. Scroll back up, it restores once.
  • Check 1575px, the tightest fit: both menu rows sit inside the white bar.
  • Open a megamenu while scrolled: full width, first column in line with the logo.
  • Logged in: the header sits directly below the admin bar.
  • Below 1200px: unchanged from develop.

Before this ships to production, comment out .header--blog-name img { margin-top: -16px } in the Customizer as already done on staging, or the logo sits 8px above centre.

🤖 Generated with Claude Code

https://claude.ai/code/session_011rCHPCdbV5C5dDJjEmMDuy

mlaetitia and others added 2 commits September 30, 2026 19:02
The header shrank on scroll until #241 removed it. Shrinking a `position:
sticky` header reflows the page, Chrome corrects scrollY to hold its scroll
anchor still, and that correction re-crosses the shrink threshold in a loop.
That was the flicker, and it was Chrome-only because Safari has no scroll
anchoring.

Fixing the header to the viewport and leaving a constant-height spacer in its
place means the shrink costs the document nothing, so nothing corrects and
nothing loops. The header then spans the viewport, so it carries the wrapper's
inset itself and the megamenu panel no longer needs to escape one.

125px to 90px is as far as the bar can go: the logo column is pinned at 300px
so the menu never reflows, which leaves the menu two rows below roughly
1690px, and two rows need 88px once `$navPadSmall` tightens the nav.

Desktop only. Below `$break-nav` the off-canvas menu measures itself against
`$headerInnerHeight`, so the mobile header keeps its height and only the logo
shrinks, exactly as before.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_011rCHPCdbV5C5dDJjEmMDuy
@mlaetitia
mlaetitia merged commit 961306b into develop Sep 30, 2026
5 checks passed
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