Skip to content

feat: make navbar sticky on scroll#667

Merged
Zahnentferner merged 1 commit intoAOSSIE-Org:mainfrom
reach2saksham:feat/sticky-navbar
Mar 15, 2026
Merged

feat: make navbar sticky on scroll#667
Zahnentferner merged 1 commit intoAOSSIE-Org:mainfrom
reach2saksham:feat/sticky-navbar

Conversation

@reach2saksham
Copy link
Contributor

@reach2saksham reach2saksham commented Mar 14, 2026

Addressed Issues:

Fixes #647
This PR addresses issue #647, resolving the behaviour where the Navbar hides/moves while navigating long pages. Previously, the Header component was adopting behaviour from an initial UI template that pushed the navigation out of view using calculated CSS variables attached to a scroll-tracking useEffect.

The navigation component is now permanently affixed across all environments and pages, resulting in:

  • A consistently persistent view, avoiding extreme "scroll to top" tasks.
  • Improved accessibility and simpler component lifecycle logic.

Screenshots/Recordings:

Before:
image

After:
image

Additional Notes:

AI Usage Disclosure:

We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact. AI slop is strongly discouraged and may lead to banning and blocking. Do not spam our repos with AI slop.

Check one of the checkboxes below:

  • This PR does not contain AI-generated code at all.
  • This PR contains AI-generated code. I have read the AI Usage Policy and this PR complies with this policy. I have tested the code locally and I am responsible for it.

I have used the following AI models and tools: TODO

Checklist

  • My PR addresses a single issue, fixes a single bug or makes a single improvement.
  • My code follows the project's code style and conventions
  • If applicable, I have made corresponding changes or additions to the documentation
  • If applicable, I have made corresponding changes or additions to tests
  • My changes generate no new warnings or errors
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contribution Guidelines
  • Once I submit my PR, CodeRabbit AI will automatically review it and I will address CodeRabbit's comments.
  • I have filled this PR template completely and carefully, and I understand that my PR may be closed without review otherwise.

Summary by CodeRabbit

  • Style
    • Enhanced header behavior to remain visible and accessible at the top of the page while scrolling through content.

@coderabbitai
Copy link

coderabbitai bot commented Mar 14, 2026

📝 Walkthrough

Walkthrough

This pull request adds sticky positioning to the header element by updating its Tailwind CSS classes. The header changes from relative to sticky positioning with top-0 applied, ensuring it remains visible at the top of the viewport during page scrolling.

Changes

Cohort / File(s) Summary
Header Positioning
src/components/shared/Header.jsx
Updated className to make header sticky at the top of the page by replacing relative with sticky, adding top-0 for viewport alignment, and pt-6 for padding. This enables the header to remain visible during vertical scrolling.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

Suggested reviewers

  • Zahnentferner

Poem

🐰 A sticky header hops along,
No more scrolling up is wrong,
At the top it loves to stay,
Through the page, come what may! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: make navbar sticky on scroll' directly and clearly describes the main change: making the navbar sticky, which matches the primary modification in the changeset.
Linked Issues check ✅ Passed The PR successfully addresses the linked issue #647 by implementing sticky navbar positioning through CSS class modifications, ensuring the navbar remains permanently visible during scrolling.
Out of Scope Changes check ✅ Passed All changes are directly related to the sticky navbar objective; only the Header.jsx className was modified to add sticky positioning, with no extraneous modifications.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/components/shared/Header.jsx (1)

269-363: Consider simplifying or removing unused scroll-tracking logic.

The useEffect contains substantial scroll-tracking code (updateHeaderStyles, updateAvatarStyles) that was designed to dynamically hide/show the header and animate the avatar. With the new sticky top-0 approach, much of this logic may be redundant or could conflict with the simpler sticky behavior.

If the avatar scaling animation on the home page is still desired, the logic can be retained but isolated. Otherwise, this could be significantly simplified to just set initial CSS variables without scroll listeners.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/shared/Header.jsx` around lines 269 - 363, The effect
registers heavy scroll logic (updateHeaderStyles, updateAvatarStyles inside the
useEffect) that is now largely redundant with the new sticky top-0 approach;
either remove the scroll listeners and the functions entirely or keep only the
avatar animation isolated: extract updateAvatarStyles and its dependency on
isHomePage into a separate hook (or effect) that only runs on the home page, and
simplify the original useEffect to set initial CSS variables (using
avatarRef/headerRef and isInitial) without adding window scroll/resize
listeners; ensure removal of window.addEventListener calls and corresponding
removeEventListener cleanup when deleting the handlers, or move them to the
isolated hook so updateHeaderStyles is removed and updateAvatarStyles remains
only when isHomePage is true.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/components/shared/Header.jsx`:
- Around line 269-363: The effect registers heavy scroll logic
(updateHeaderStyles, updateAvatarStyles inside the useEffect) that is now
largely redundant with the new sticky top-0 approach; either remove the scroll
listeners and the functions entirely or keep only the avatar animation isolated:
extract updateAvatarStyles and its dependency on isHomePage into a separate hook
(or effect) that only runs on the home page, and simplify the original useEffect
to set initial CSS variables (using avatarRef/headerRef and isInitial) without
adding window scroll/resize listeners; ensure removal of window.addEventListener
calls and corresponding removeEventListener cleanup when deleting the handlers,
or move them to the isolated hook so updateHeaderStyles is removed and
updateAvatarStyles remains only when isHomePage is true.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c9e4e6f9-b49f-4f4c-ad56-f01d152cd441

📥 Commits

Reviewing files that changed from the base of the PR and between 3fa685f and a95ef70.

📒 Files selected for processing (1)
  • src/components/shared/Header.jsx

@Zahnentferner Zahnentferner merged commit 3084b32 into AOSSIE-Org:main Mar 15, 2026
1 check 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.

[FEATURE]: Navbar not sticking at the top

2 participants