Skip to content

#524:Add smooth section scroll navigation#618

Open
Pragzh wants to merge 1 commit into
GitMetricsLab:mainfrom
Pragzh:smooth-section-scroll
Open

#524:Add smooth section scroll navigation#618
Pragzh wants to merge 1 commit into
GitMetricsLab:mainfrom
Pragzh:smooth-section-scroll

Conversation

@Pragzh
Copy link
Copy Markdown
Contributor

@Pragzh Pragzh commented May 30, 2026

Related Issue


Description

Implemented smooth section scroll navigation across the landing page to improve user experience and navigation flow.

The update ensures that navigating between landing page sections feels smooth and modern instead of abruptly jumping between sections.


Changes Made

  • Added smooth scrolling behavior globally using CSS
  • Added section IDs for landing page navigation targets
  • Improved navbar section navigation behavior
  • Fixed navigation from other pages (e.g. Contributors → Home/Features)
  • Added proper scroll offset handling for fixed navbar
  • Preserved responsive behavior across desktop and mobile views

How Has This Been Tested?

  • Tested smooth scrolling on landing page sections
  • Verified navigation from /contributors back to homepage sections
  • Checked responsive behavior on desktop and mobile
  • Confirmed no layout/UI breakage after scroll updates

Screenshots (if applicable)

github.tracker.mp4

Type of Change

  • Bug fix
  • New feature
  • Code style update
  • Breaking change
  • Documentation update

Summary by CodeRabbit

Release Notes

  • New Features
    • Added smooth scrolling navigation – clicking navigation items now smoothly scrolls to corresponding page sections instead of jumping instantly.
    • Improved anchor positioning – sections align properly below the header when navigated to via direct links.

Review Change Stack

@netlify
Copy link
Copy Markdown

netlify Bot commented May 30, 2026

Deploy Preview for github-spy ready!

Name Link
🔨 Latest commit 5f10b1b
🔍 Latest deploy log https://app.netlify.com/projects/github-spy/deploys/6a1aa49597336000088f4170
😎 Deploy Preview https://deploy-preview-618--github-spy.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 30, 2026

📝 Walkthrough

Walkthrough

The PR implements smooth section scroll navigation by converting route-based navigation to hash-based anchors, adding section IDs, and configuring smooth scrolling behavior with proper offset margins in CSS.

Changes

Hash-based section navigation

Layer / File(s) Summary
Smooth scroll foundation
src/index.css
CSS enables smooth scrolling globally and applies scroll-margin-top: 90px to sections for proper offset positioning with a fixed header.
Hero section anchor
src/components/Hero.tsx
Hero section receives id="home" to enable direct scroll-to-section targeting.
Navigation anchor links
src/components/Navbar.tsx
Desktop and mobile navigation links switch from NavLink route-based components to plain <a> anchor tags with hash href values (#home, /#features, /#how-it-works); mobile links call closeMenu on click.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • GitMetricsLab/github_tracker#476: Both PRs modify src/components/Hero.tsx, with this PR adding the id="home" attribute while the other PR substantially rewrites Hero layout and styling.

  • GitMetricsLab/github_tracker#237: Overlapping changes to src/components/Navbar.tsx for hash-based anchor navigation and smooth scroll behavior in header links.

Suggested labels

level:intermediate, quality:clean

Poem

🐰 Smooth scroll, section by section,
No more jarring direction,
Hash anchors glide with grace,
Landing pages find their place.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add smooth section scroll navigation' accurately summarizes the main change of implementing smooth scrolling for section navigation on the landing page.
Description check ✅ Passed The PR description includes all required template sections: Related Issue, Description with detailed changes, How Has This Been Tested, Screenshots, and Type of Change. All sections are adequately filled with relevant information.
Linked Issues check ✅ Passed The PR successfully addresses the primary requirement from issue #524 by implementing smooth scrolling animations for internal navigation links, improving the landing page navigation flow and user experience.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing smooth section scroll navigation: adding IDs to sections, modifying navbar links to use anchors, implementing CSS smooth scrolling, and handling scroll offsets for the fixed navbar.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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
Copy Markdown
Contributor

@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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/index.css (1)

92-94: ⚡ Quick win

Honor reduced-motion preference for smooth scroll.

Line 92 enables smooth scrolling globally, but there’s no prefers-reduced-motion override. Add a reduced-motion fallback to avoid forced animation for affected users.

Proposed patch
 html {
   scroll-behavior: smooth;
 }
+
+@media (prefers-reduced-motion: reduce) {
+  html {
+    scroll-behavior: auto;
+  }
+}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/index.css` around lines 92 - 94, The global html rule sets
scroll-behavior: smooth without honoring users' reduced-motion preference; add a
media query `@media` (prefers-reduced-motion: reduce) that overrides the html
selector's scroll-behavior to auto (or unset) so users who prefer reduced motion
won't get forced smooth scrolling, updating the existing html { scroll-behavior:
smooth; } rule and adding the override media block.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/Navbar.tsx`:
- Around line 44-46: The "Home" anchor elements in the Navbar component
currently use href="`#home`" which breaks cross-page navigation; update the Home
link(s) (the <a> elements whose inner text is "Home" and className includes
"px-4 py-2 rounded-xl..." in the Navbar component) to use "/#home" instead so
the link returns to the landing page from any route (apply the same change to
both occurrences referenced in the diff).

---

Nitpick comments:
In `@src/index.css`:
- Around line 92-94: The global html rule sets scroll-behavior: smooth without
honoring users' reduced-motion preference; add a media query `@media`
(prefers-reduced-motion: reduce) that overrides the html selector's
scroll-behavior to auto (or unset) so users who prefer reduced motion won't get
forced smooth scrolling, updating the existing html { scroll-behavior: smooth; }
rule and adding the override media block.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: efa43907-8a0a-43be-83f8-973684e65f85

📥 Commits

Reviewing files that changed from the base of the PR and between e7b8fc8 and 5f10b1b.

📒 Files selected for processing (3)
  • src/components/Hero.tsx
  • src/components/Navbar.tsx
  • src/index.css

Comment thread src/components/Navbar.tsx
Comment on lines +44 to +46
<a href="#home" className="px-4 py-2 rounded-xl text-sm lg:text-base font-semibold transition-all duration-300 text-slate-700 dark:text-gray-300 hover:text-blue-500">
Home
</a>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Use homepage hash for “Home” links to avoid broken cross-page navigation.

Line 44 and Line 117 use href="#home", which won’t navigate back to the landing page from routes like /contributors. Use /#home (consistent with the other section links) so Home works from any page.

Proposed patch
-          <a href="`#home`" className="px-4 py-2 rounded-xl text-sm lg:text-base font-semibold transition-all duration-300 text-slate-700 dark:text-gray-300 hover:text-blue-500">
+          <a href="/#home" className="px-4 py-2 rounded-xl text-sm lg:text-base font-semibold transition-all duration-300 text-slate-700 dark:text-gray-300 hover:text-blue-500">
   Home
 </a>
@@
-            <a
-  href="`#home`"
+            <a
+  href="/#home"
   className="px-4 py-2 rounded-xl text-sm lg:text-base font-semibold transition-all duration-300 text-slate-700 dark:text-gray-300 hover:text-blue-500"
   onClick={closeMenu}
 >

Also applies to: 116-123

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/Navbar.tsx` around lines 44 - 46, The "Home" anchor elements
in the Navbar component currently use href="`#home`" which breaks cross-page
navigation; update the Home link(s) (the <a> elements whose inner text is "Home"
and className includes "px-4 py-2 rounded-xl..." in the Navbar component) to use
"/#home" instead so the link returns to the landing page from any route (apply
the same change to both occurrences referenced in the diff).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Add Smooth Section Scroll Navigation on Landing Page

1 participant