fix: stop the session switcher from shifting the mobile shell - #477
Merged
Merged
Conversation
Centering the active row with scrollIntoView also scrolled the overflow-hidden workbench while the sheet was still translated 16px by its slide-up animation, so the whole app moved up and eased back. Scroll the sheet's own list instead.
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
Opening the session switcher on a phone made the whole app jitter: the UI moved up ~16px and eased back.
Cause
The switcher centers the active session row with
scrollIntoView({ block: "center" })in auseEffectthat runs while the sheet panel is still translated 16px by its slide-up animation. Becauseoverflow: hiddencontainers are still programmatically scrollable, the browser also scrolled the workbench root to bring the row into view; as the animation settled, the overflow shrank andscrollTopwas clamped back to 0 frame by frame.Frame sampling before the fix:
workbenchScrollTop16 → 9 → 5 → 3 → 2 → 1 → 0. After: constant 0.Fix
Scroll the sheet's own list container directly (
Sheetgains an optionalscrollRef) and center the active row by computingscrollTopfrom the row/container rects.Verification
pnpm typecheck,pnpm test(360 passed)E2E_TEST_GREP='session switcher|mobile navigation|title bar' pnpm e2e:test→ 7 passed