Skip to content

✨Enhancement: Smooth scrolling and correct routing for "Features" navbar link (#72)#91

Merged
indresh404 merged 1 commit into
indresh404:mainfrom
nitishchaubeyy:fix/features-smooth-scroll
May 31, 2026
Merged

✨Enhancement: Smooth scrolling and correct routing for "Features" navbar link (#72)#91
indresh404 merged 1 commit into
indresh404:mainfrom
nitishchaubeyy:fix/features-smooth-scroll

Conversation

@nitishchaubeyy
Copy link
Copy Markdown
Contributor

Description

Resolves #72

This PR fixes the cross-page navigation issue where clicking the "Features" link from a different route (e.g., /about or /login) correctly routed to the Home page but failed to scroll down to the Features section.

🚀 Changes Made:

  • Imported useLocation from react-router-dom and useEffect from react in Home.jsx.
  • Added a useEffect hook that listens to changes in the location object.
  • Implemented a smooth scroll mechanism using element.scrollIntoView() wrapped in a slight timeout (100ms) to ensure the DOM is fully painted before scrolling.
  • Ensured that navigating back to the bare / route without a hash automatically scrolls the user smoothly to the top of the page.

🧪 Testing Done:

  • Verified smooth scrolling to the features section when clicking the link from the top of the Home page.
  • Verified successful routing and automatic smooth scrolling when clicking the "Features" link from an entirely different page (cross-page hash routing).

@vercel
Copy link
Copy Markdown

vercel Bot commented May 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ranker-hub Ready Ready Preview, Comment May 30, 2026 9:43pm

@github-actions github-actions Bot added bug Something isn't working enhancement New feature or request frontend Frontend related changes (HTML/CSS/JS/React) gssoc GirlScript Summer of Code gssoc26 GirlScript Summer of Code 2026 nsoc NSoC NSoC'26 NSoC 2026 pending-review PR is pending review labels May 30, 2026
@indresh404 indresh404 merged commit bb13bf4 into indresh404:main May 31, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request frontend Frontend related changes (HTML/CSS/JS/React) gssoc GirlScript Summer of Code gssoc26 GirlScript Summer of Code 2026 level:advanced level3 nsoc NSoC NSoC'26 NSoC 2026 pending-review PR is pending review type:design

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement] Smooth scrolling and correct routing for "Features" navbar link

2 participants