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

Navbar Resize is Not Smooth on Scroll #709

Closed
adityajha2005 opened this issue Feb 27, 2025 · 0 comments
Closed

Navbar Resize is Not Smooth on Scroll #709

adityajha2005 opened this issue Feb 27, 2025 · 0 comments

Comments

@adityajha2005
Copy link

adityajha2005 commented Feb 27, 2025

Description:

When scrolling down, the navbar shrinks in size, but the transition is not smooth. It appears to be laggy, possibly due to excessive re-renders or inefficient event handling.

Steps to Reproduce:

  1. Scroll down the page to trigger the navbar resize.
  2. Observe the navbar shrinking behavior.
  3. Notice that the transition is not smooth, and the navbar may feel jittery or unresponsive.

Expected Behavior:

The navbar should shrink smoothly without any noticeable lag or abrupt jumps.

Possible Causes:

  • Too many state updates causing re-renders.
  • Inefficient handling of scroll events.
  • Lack of proper CSS transitions for smooth resizing.

Suggested Fixes:

Optimize Scroll Event Handling:

  • Use throttling or debouncing to limit the number of state updates.
  • Consider using useRef instead of useState to avoid unnecessary re-renders.

Improve CSS Transitions:

  • Ensure that the navbar height change is animated smoothly using transition: height 0.3s ease-in-out;.

Proof:

2025-02-28.00-50-35.mp4
@adityajha2005 adityajha2005 closed this as not planned Won't fix, can't repro, duplicate, stale Feb 27, 2025
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

No branches or pull requests

1 participant