Scroll to top on movement wizard step change - #824
Merged
Conversation
Wizard steps change a Redux page index without a route change, so the app-level scroll-to-top (keyed on the location) never fired between steps. On mobile the retained scroll position left the flight type and step header off-screen after advancing. Reset the window scroll on each step change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Customer (LSZO) feedback: on mobile, the flight type (Private, Para Drop,
etc.) is not always visible when moving through the movement wizard —
switching to the next step keeps the previous scroll position, leaving
the flight-type field and step header (both near the top) off-screen.
Cause
Wizard steps are driven by a Redux
pageindex, without a URLchange. The app-level scroll-to-top (
App.tsx, keyed on the routelocation) therefore never fires between wizard steps. On mobile the whole
window scrolls, so the retained position carries over.
Fix
Add a
useEffectinMovementWizard.tsxthat callswindow.scrollTo(0, 0)wheneverwizard.pagechanges — firing on bothNext and Back. Reuses the exact call already used in
App.tsx.Verification
npm run typecheckclean; full Jest suite green (2286 tests).MovementWizard.spec.tsxtests: scrolls to top on page change,does not scroll on an unrelated re-render.
npm run build --project=lszmcompiles.Next/Back, confirm the new step opens at the top.