sujaltangde / JobLane

JobLane - Full Stack Job application portal built using MERN Stack
https://joblane.vercel.app/
55 stars 50 forks source link

🪲[Bug]: Page Does Not Scroll to Top on Route Change #130

Open pani2004 opened 4 months ago

pani2004 commented 4 months ago

When navigating to a new route, such as /jobs(by clicking the job in footer section), the page content opens at the bottom, requiring the user to scroll to top to see the beginning of the page content. This behavior is not user-friendly and impacts the user experience, as users expect to start at the top of the new page content when navigating through routes.

https://github.com/sujaltangde/JobLane/assets/154724111/2097db37-731c-4b79-872a-e6e47ac7c500

pani2004 commented 4 months ago

@sujaltangde can u assign me this?

piyushmishra1416 commented 4 months ago

Hey, @pani2004 can you come up with the solution as well? After that, we can assign you this issue.

pani2004 commented 4 months ago

@piyushmishra1416 in the job route by using a use effect hook and inside that hook the window.scrollTo top function will be there so that when the component will be rendered the page automatically renders in the top.

pani2004 commented 3 months ago

@sujaltangde @piyushmishra1416 Pls review it and assign it to me

pani2004 commented 3 months ago

@sujaltangde @piyushmishra1416 Pls review it!!!

piyushmishra1416 commented 3 months ago

Hello @pani2004 this is the only option left for you now 😂 https://x.com/cHHillee/status/1799227713401835724?t=F8gfVO6gvOn3-NjKqdzEOw

piyushmishra1416 commented 3 months ago

@piyushmishra1416 in the job route by using a use effect hook and inside that hook the window.scrollTo top function will be there so that when the component will be rendered the page automatically renders in the top.

Your approach using the use effect hook with window.scrollTo(0, 0) sounds correct to me @pani2004 . Since @sujaltangde is currently inactive and has the necessary maintainer access, what you can do is submit a Pull Request once the changes are made.

Even though I don't have merge access either, submitting a pull request will ensure your solution is documented and available for review once someone with the necessary permissions is active again.

pani2004 commented 2 months ago

@sujaltangde Review this issue

sujaltangde commented 2 months ago

@pani2004 go for it