fix(mobile): keep swipe rows from stopping half open in WebKit

Merged
OC
2d ago
+16-1

Swipe rows on the iOS Tasks tab can stop half open (since #1792). macOS Safari with a trackpad shows the same thing.

Cause: WebKit drops a zero-width snap area. In ScrollSnapOffsetsInfo.cpp, findCompatibleSnapArea keeps a candidate only if offset + viewportLength > areaMin. For the w-0 snap-end anchor these two are equal, so the open position is never a candidate. A directional scroll (trackpad, wheel) then has no snap target and stays where it stopped. A programmatic scroll falls back to 0. Chromium handles the zero-width area correctly.

Fix: make the anchor 1px wide and pull it back with -ml-px. scrollWidth and the open position (actionWidth) do not change.

Test: a new swipe-row.test.tsx case scrolls to actionWidth - 26 and expects a snap to actionWidth. In WebKit it fails before the fix (scrollLeft is 0) and passes after. It also passes in Chromium.

Written by Claude Opus 5.5.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Summary by Sourcery

Ensure swipe-row scrolling reliably snaps to the open position in WebKit.

Bug Fixes:

  • Prevent swipe rows from stopping in a partially open state in WebKit by ensuring the open snap position is recognized.
  • Add coverage for snapping near the open position across browser engines.

Tests:

  • Add a SwipeRow test verifying that scrolling past halfway snaps to the fully open position.

Summary by CodeRabbit

  • Bug Fixes
    • Swipe rows now snap consistently to the full action width when scrolling slightly past it, making the interaction more predictable. The row settles at the action boundary instead of stopping at an unintended position, including when the scroll moves just beyond the width of the available actions.