Fix tab indicator animation drift
Merged
LA
6mo ago+129+129+012345678901234567890123456789-0-0-0123456789
Summary
- Adds Bonsplit rendering tests for the active tab indicator under horizontal scroll and inherited animated selection transactions.
- Makes the selected tab indicator opt out of inherited SwiftUI animations so it snaps to the selected tab frame.
- Hardens the manual-scroll test so missing scroll-view setup fails instead of looking like the expected offscreen indicator result.
Validation
- Red failure before fix:
testActiveTabIndicatorIgnoresAnimatedSelectionTransactionsfailed with indicator lowerBound11.0, expected>44.0. - Green pass:
swift test --package-path vendor/bonsplit --filter BonsplitTests.testActiveTabIndicatorpassed on the cmux cloud Mac.
Parent PR
- Required by https://github.com/manaflow-ai/cmux/pull/4873 so the cmux submodule pointer is reachable from Bonsplit
main.
Need help on this PR? Tag @codesmith with what you need. Autofix is disabled.
Summary by cubic
Fixes the active tab indicator drifting between tabs. The indicator now ignores inherited animations and snaps to the selected tab, and it scrolls out with its tab during horizontal scroll.
- Bug Fixes
- Disabled animations for the selected indicator in
TabBarViewusing a local transaction to prevent drift during animated selection changes. - Added rendering tests for horizontal scroll and animated selection; manual-scroll test now fails if the scroll view isn’t set up.
- Disabled animations for the selected indicator in
Summary by CodeRabbit
-
Bug Fixes
- Fixed tab indicator animation behavior to ensure smooth state updates without unwanted animation effects.
-
Tests
- Added test cases validating tab indicator visibility during scrolling and immediate selection behavior during animated transitions.