Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: header scroll looping and firefox slow animation #126

Merged
merged 6 commits into from
Oct 21, 2024

Conversation

Xaroz
Copy link
Contributor

@Xaroz Xaroz commented Oct 18, 2024

Scroll loop fix

Fixed an issue where on some specific threshold it would cause the header to loop the scaling animation because of the height changes. Move timeoutId so the variable is not re-created everytime and added a missing logic that would prevent proper debouncing

Caveat: If the scroll is extremely fast it might cause the header to be stuck on a certain threshold until a new scroll happens

Firefox animation fix

Fixed an issue with Firefox choppy and slow animation, basically some browsers struggle with animation because of the way they render a page, so the "trick" is to make the browser go into hardware acceleration mode by adding a slight rotation and this way the animations will run smoother

On Firefox if you pay really close attention there's still a bit of a delay/blurriness that is almost not noticeable when the animation finishes

Copy link

vercel bot commented Oct 18, 2024

@Xaroz is attempting to deploy a commit to the Abacus Works Team on Vercel.

A member of the Team first needs to authorize it.

@Xaroz Xaroz changed the title fix: header scroll looping and firefox issue fix: header scroll looping and firefox slow animation Oct 18, 2024
Copy link

vercel bot commented Oct 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hyperlane-explorer ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 21, 2024 4:42pm

Copy link
Collaborator

@jmrossy jmrossy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this. It does seem to work but your debounce function is a bit sloppy and I don't think you're handling your callback memoization correctly yet. Please have a closer look.

src/components/nav/Header.tsx Outdated Show resolved Hide resolved
src/utils/useScrollListener.ts Show resolved Hide resolved
src/utils/useScrollListener.ts Outdated Show resolved Hide resolved
src/utils/useScrollListener.ts Outdated Show resolved Hide resolved
src/utils/useScrollListener.ts Outdated Show resolved Hide resolved
@jmrossy jmrossy merged commit f298a98 into hyperlane-xyz:main Oct 21, 2024
6 checks passed
@Xaroz Xaroz deleted the fix/header-scrolling branch October 21, 2024 18:49
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.

2 participants