Skip to content

fix: stop the session switcher from shifting the mobile shell - #477

Merged
chareice merged 1 commit into
mainfrom
fix/mobile-switcher-scroll-shift
Sep 13, 2026
Merged

chareice merged 1 commit into
mainfrom
fix/mobile-switcher-scroll-shift

Conversation

@chareice

Copy link
Copy Markdown
Collaborator

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 a useEffect that runs while the sheet panel is still translated 16px by its slide-up animation. Because overflow: hidden containers are still programmatically scrollable, the browser also scrolled the workbench root to bring the row into view; as the animation settled, the overflow shrank and scrollTop was clamped back to 0 frame by frame.

Frame sampling before the fix: workbenchScrollTop 16 → 9 → 5 → 3 → 2 → 1 → 0. After: constant 0.

Fix

Scroll the sheet's own list container directly (Sheet gains an optional scrollRef) and center the active row by computing scrollTop from 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

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.
@chareice
chareice merged commit 6728c0c into main Sep 13, 2026
8 checks passed
@chareice
chareice deleted the fix/mobile-switcher-scroll-shift branch September 13, 2026 01:46
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.

1 participant