Skip to content

Shrink the sticky header sooner, and stop it toggling in a loop - #240

Merged
mlaetitia merged 1 commit into
developfrom
fix/header-shrink-on-scroll-develop
Sep 25, 2026
Merged

mlaetitia merged 1 commit into
developfrom
fix/header-shrink-on-scroll-develop

Conversation

@mlaetitia

@mlaetitia mlaetitia commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

Related to #

Proposed changes

  • Shrink the sticky header after 40px of scrolling instead of 100px, and stop it flickering around the threshold.
  • Animate the size change.

Why are these changes being made?

  • The header is sticky but still sits in flow, so shrinking it lifts the page by 25px. The threshold now depends on which state the header is in.
  • max-height had no starting length to animate from, so the size jumped while only padding eased. Below 1200px the padding matches in both states, so nothing animated at all.

Testing instructions

  • Scroll down: the header shrinks past ~40px with no flicker.
  • Scroll up mid-page: it stays small until the very top.
  • Chrome, Firefox and Safari, at desktop and mobile widths.

🤖 Generated with Claude Code

https://claude.ai/code/session_011rCHPCdbV5C5dDJjEmMDuy

The header shrank only after 100px of scrolling, and a single threshold meant
the 25px the page lifts on shrinking could be handed back by scroll anchoring,
re-crossing the bound and toggling the class repeatedly. The threshold to beat
now depends on which state the header is in, so no correction can reach the
other bound, and the handler runs once per animation frame on a passive
listener. Mobile and desktop share one path; the mobile header no longer grows
back mid-page on an upward scroll.

max-height had no length to animate from, so the shrink snapped rather than
eased; the base rules now set one, and the transitions name the properties that
actually change.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011rCHPCdbV5C5dDJjEmMDuy
@mlaetitia
mlaetitia merged commit ff835ee into develop Sep 25, 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