Skip to content

Conversation

prakhar-174
Copy link
Contributor

@prakhar-174 prakhar-174 commented Oct 16, 2025

Pull Request

Thanks for contributing to Hacktoberfest 2025!

Description

This PR implements automatic scroll-to-top behavior when navigating between routes in the SPA. Previously, when users scrolled down on one page and navigated to another, they would remain at the same scroll position, causing confusion. This fix ensures every route transition starts from the top of the page.

Changes made:

  • Created ScrollToTop component that uses useLocation hook to detect route changes
  • Integrated ScrollToTop into RootLayout to apply globally across all routes
  • Scroll position now resets to top (0, 0) on every navigation

Issue: Fixes scroll position persistence bug during SPA navigation
Closes #113

Checklist

  • My code builds and runs locally
  • I’ve added/updated documentation if needed
  • I’ve tested my changes
  • I’ve linked related issues (if any)
  • (Optional) I’ve credited myself with the All Contributors bot if this is my first contribution or a new contribution type

@Alexandrbig1
Copy link
Contributor

@prakhar-174, thanks for your contribution. Please just delete the package-lock.json file from the PR, and I'll accept it. Thank you

The conflicting file package-lock.json was deleted.
@prakhar-174
Copy link
Contributor Author

Hello @Alexandrbig1 , I have removed the package-lock.json file that was generated after executing the command npm install --legacy-peer-deps. The pull request has now been updated and no longer shows any conflicts with the base branch.

Copy link
Contributor

@Alexandrbig1 Alexandrbig1 left a comment

Choose a reason for hiding this comment

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

Welcome to Open Code Chicago! 🎉
Thank you for making your first contribution here — we’re glad to have you.

@Alexandrbig1 Alexandrbig1 added frontend Tasks related to the frontend (React, Vite, TailwindCSS, UI components, pages) hacktoberfest Special issue for Hacktoberfest hacktoberfest-2025 Special issue for Hacktoberfest 2025 hacktoberfest-accepted This label indicates that a contribution has been accepted and counts toward Hacktoberfest rewards. react React components & UI logic tailwind Tailwind CSS & styling labels Oct 21, 2025
@Alexandrbig1 Alexandrbig1 added this to the Hacktoberfest 2025 milestone Oct 21, 2025
@Alexandrbig1 Alexandrbig1 merged commit 8cc55bb into OpenCodeChicago:main Oct 21, 2025
4 checks passed
@Alexandrbig1 Alexandrbig1 linked an issue Oct 21, 2025 that may be closed by this pull request
@Alexandrbig1
Copy link
Contributor

Hey @prakhar-174 ,

🎉 Congratulations on your first merged pull request!
You’ve just taken a huge step in your open-source journey — and we’re so excited it happened here at Open Code Chicago × CoreX 💪

To celebrate this milestone, you’ve earned the “First PR Merged” badge on Holopin 🏅
👉 Claim your badge here: Claim Badge

Once claimed, you can proudly showcase it on your GitHub profile, Holopin board, or share it on LinkedIn to mark your first contribution to the open-source world 🌟

Keep contributing, keep growing, and welcome to the Open Code Chicago community! 🚀
— Open Code Chicago Team

@Alexandrbig1
Copy link
Contributor

@prakhar-174, congratulations on your merged PR! 🎉 Don’t forget to add yourself as a contributor using our all-contributors bot. You can find instructions in our CONTRIBUTING.md. Thanks again for your contribution!

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

Labels

frontend Tasks related to the frontend (React, Vite, TailwindCSS, UI components, pages) hacktoberfest Special issue for Hacktoberfest hacktoberfest-2025 Special issue for Hacktoberfest 2025 hacktoberfest-accepted This label indicates that a contribution has been accepted and counts toward Hacktoberfest rewards. react React components & UI logic tailwind Tailwind CSS & styling

Development

Successfully merging this pull request may close these issues.

Scroll to Top on Route Change

2 participants