Fix tab indicator animation drift

Merged
LA
6mo ago
+129-0

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: testActiveTabIndicatorIgnoresAnimatedSelectionTransactions failed with indicator lowerBound 11.0, expected >44.0.
  • Green pass: swift test --package-path vendor/bonsplit --filter BonsplitTests.testActiveTabIndicator passed on the cmux cloud Mac.

Parent PR


View with Codesmith Autofix with Codesmith
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 TabBarView using 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.

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.

Review Change Stack