Repository navigation
fix: navigation bar flickering on scroll - #2396
Open
vforvaishnavi4510-boop wants to merge 2 commits into
Open
vforvaishnavi4510-boop wants to merge 2 commits into
vforvaishnavi4510-boop wants to merge 2 commits into
Conversation
|
@vforvaishnavi4510-boop is attempting to deploy a commit to the Piyush Garg's projects Team on Vercel. A member of the Team first needs to authorize it. |
Author
|
“Ready for review. The Vercel check needs team authorization to deploy a preview.” |
This branch has not been deployed
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.
Fixes #2395
Top Navigation Bar Flickers/Disappears While Scrolling on the Home Page
Problem
When scrolling past ~80px, the header rapidly flickered between its normal and "shrunk" states.
Root cause
The base
.headerand.header__shrinkclasses had different layout properties:.header(base).header__shrinkpositionstatic(default)stickyheight94px(60pxon mobile)80pxEvery time the scroll handler toggled the class at the 80px threshold, the header moved in and out of the document flow and changed height. This shifted the page content, which moved
scrollYback across the threshold, which toggled the class again. The result was a feedback loop that appeared as flickering.Changes
header.module.css.headeris nowposition: stickywithtop: 0andz-index: 1000in both states, so the layout never changes..header__shrinknow only applies abox-shadow(visual change only, no layout change).transition: box-shadow 0.3s easefor a smooth shadow fade.box-shadowdeclaration.var(--site-theme-color) 44is not valid CSS, so the shadow was being ignored. It now usescolor-mix(in srgb, var(--site-theme-color) 27%, transparent)..headerrule and the duplicatemax-width: 768pxmedia query.Header.jsxheaderFunc: theheader__shrinkclass is added whenscrollY > 100and removed whenscrollY < 20. A small layout shift or scroll bounce can no longer flip the state back and forth.Testing
Tested manually, as this is a visual/scroll behavior fix:
Screenshots / Recording
VN20261117_102101.mp4
| Before |
before.mp4
Notes
Header.jsxandheader.module.cssare changed. No new dependencies.color-mix()is supported in all current major browsers (Chrome 111+, Safari 16.2+, Firefox 113+). If older browser support is needed, it can be replaced with a hardcoded rgba/hex-alpha shadow color.