Skip to content

fix: restore expected scroll behavior during route navigation - #290

Merged
David1984TK merged 3 commits into
David1984TK:mainfrom
Praizfotos:fix/scroll-to-top-route-navigation
Jul 31, 2026
Merged

fix: restore expected scroll behavior during route navigation#290
David1984TK merged 3 commits into
David1984TK:mainfrom
Praizfotos:fix/scroll-to-top-route-navigation

Conversation

@Praizfotos

Copy link
Copy Markdown
Contributor

Summary

Closes #246

This PR improves navigation by resetting the scroll position to the top of the page whenever users navigate to a new route, while preserving the browser's native scroll restoration behavior for Back and Forward navigation.

Problem

Previously, navigating between routes preserved the previous page's scroll position. For example, opening a project after scrolling to the bottom of the project list caused the detail page to open halfway down instead of starting at the top.

Solution

Introduced a lightweight ScrollToTop component in bimex-frontend/src/App.jsx.

Behavior:

  • Scrolls to (0, 0) on PUSH navigation.
  • Scrolls to (0, 0) on REPLACE navigation.
  • Preserves native browser scroll restoration on POP navigation.
  • Uses useNavigationType from react-router-dom.
  • Adds no new dependencies.

Validation

  • npm run test:run (139/139 tests passing)
  • npm run build
  • npm run lint (no new warnings or errors)

Scope

  • Small UI/UX improvement (~12 lines of code)
  • No business logic changes
  • No new dependencies
  • No unrelated modifications

@Praizfotos
Praizfotos requested a review from David1984TK as a code owner July 31, 2026 03:30
@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown

@Francisasala is attempting to deploy a commit to the david1984tk's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jul 31, 2026

Copy link
Copy Markdown

@Praizfotos Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Praizfotos
Praizfotos force-pushed the fix/scroll-to-top-route-navigation branch from f615aa9 to e889fa0 Compare July 31, 2026 03:37

@David1984TK David1984TK left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Fix legítimo del comportamiento estándar de scroll en SPAs con react-router: sin esto, navegar entre rutas mantiene el scroll donde estaba en vez de resetear a top. Cambio chico, acotado, CI real en verde. Aprobado.

@David1984TK
David1984TK merged commit 2a02b59 into David1984TK:main Jul 31, 2026
7 of 8 checks 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.

ux: scroll al inicio al navegar entre rutas

2 participants