Conversation
Wrap the tab bar ScrollView in a ScrollViewReader and scroll to the active tab on appear and whenever activeTabId changes. Fixes tabs being off-screen when opening the app with a far-right active tab, creating new tabs, or navigating via keyboard shortcuts.
There was a problem hiding this comment.
Review: Approved
Summary: Clean implementation of auto-scroll behavior for the tab bar using standard SwiftUI patterns.
What's Good
-
Correct pattern usage:
ScrollViewReader+.id()is the idiomatic SwiftUI approach for programmatic scrolling -
Proper nil handling: Guard clauses correctly handle the optional
activeTabId -
Good UX decisions:
onAppearscroll has no animation (avoids jarring startup effect)onChangescroll uses smooth.easeInOut(duration: 0.2)animation.centeranchor keeps active tab visible with context
-
Minimal change: Restructures only what's necessary, no over-engineering
Testing
Per project conventions (CLAUDE.md), UI scroll behavior can't be unit tested due to MenuBarExtra limitations. The manual test plan is thorough and appropriate for this change.
Minor Note
No issues, but for awareness: if activeTabId changes rapidly (e.g., holding down Cmd+Shift+]), animations will queue. This is standard SwiftUI behavior and should be fine in practice since the final position will be correct.
LGTM
Summary
ScrollViewin aScrollViewReaderto enable programmatic scrollingTest plan