-
-
Notifications
You must be signed in to change notification settings - Fork 23.6k
feat(ui): Implement scroll-aware header with show/hide on scroll #5630
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
base: main
Are you sure you want to change the base?
feat(ui): Implement scroll-aware header with show/hide on scroll #5630
Conversation
- Add useScrollDirection custom hook to detect scroll direction and position - Update MainLayout to hide header when scrolling down and show on scroll up - Implement smooth CSS transitions with 300ms ease-in-out animation - Add performance optimizations using requestAnimationFrame - Header automatically shows when user scrolls up or is at page top - Improves navigation efficiency on long pages - Aligns with modern web UX patterns - Fully responsive across all device sizes Fixes: Improves user experience by providing quick access to navigation without scrolling to top
Summary of ChangesHello @vellanki-santhosh, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a significant user experience improvement by implementing a scroll-aware header. Previously, users had to scroll back to the top of a page to access navigation. With this change, the header now intelligently hides when scrolling down, providing more screen real estate for content, and smoothly reappears when scrolling up, allowing quick access to navigation options without interrupting the browsing flow. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a scroll-aware header, which is a great user experience improvement. The implementation is clean, using a new custom hook useScrollDirection to manage the logic and CSS transforms for the animation. My review includes a couple of key suggestions. First, I recommend refactoring the useScrollDirection hook to improve its performance and make it more reusable by avoiding a common useEffect pitfall and parameterizing hardcoded values. Second, I've identified and provided a fix for a small regression in MainLayout where an existing transition was accidentally removed. Overall, this is a solid feature addition.
📋 Description
This PR implements a scroll-aware header that automatically hides when scrolling down and reappears when scrolling up, significantly improving the user experience and navigation efficiency.
🎯 Problem Statement
Currently, when scrolling down the page, the header/navigation bar scrolls out of view. To access navigation options again, users need to scroll all the way back to the top, which interrupts the browsing flow—especially on longer pages.
✨ Changes Made
New Files
packages/ui/src/hooks/useScrollDirection.js: Custom React hook to detect scroll direction and positionrequestAnimationFramefor optimal performanceModified Files
packages/ui/src/layout/MainLayout/index.jsx: Updated to implement scroll-aware behavioruseScrollDirectionhooktranslateY(-100%)to hide header on scroll down🚀 Features
requestAnimationFrameto avoid layout thrashing🔧 Technical Implementation
transformrequestAnimationFrame📱 Testing
💡 Benefits
🎬 Demo
The header will:
📝 Related Issues
Addresses user experience improvement for navigation on long pages.
✅ Checklist