Repository navigation
fix(BottomSheet): yield to a pinch whichever finger lands first - #7198
Merged
Merged
Conversation
A pinch whose first finger landed on the sheet body and whose second landed on the handle (or off the body) could still promote the body's armed pull into a sheet drag, cancelling the zoom and dragging or throwing the sheet away. Route every second finger, on either surface and in either order, through one hand-off that drops every armed gesture and any drag in flight, and return a handle drag to its detent when the browser cancels it to take the pinch.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
AI review status for this pull request.
|
Contributor
PR Analysis Report
|
Contributor
There was a problem hiding this comment.
Approving. Whichever finger lands first, the pinch now zooms and the sheet holds its detent; reproduced the thrown sheet and its fix.
- Chrome 155 on a Linux rig, the committed spec run as-is against two Storybook builds from this head: with
useSheetGestures.tsat the merged #7192 version, 2 of 7 fail — body finger first then handle moves the sheet 571px, lower finger first at the top of the body 24.5px — and the other five pass; at this head 7 of 7 pass, twice in a row, including the one-finger handle drag and content scroll. - Red arm: with the merged hook restored, the five new unit tests fail (body-first then handle; second finger off the body; second pointer on the body's pointer path; handle drag with a finger off the sheet; browser-cancelled handle drag returns to its detent) and the other 66 pass; at this head the hook file passes 71/71 and the BottomSheet directory 254/254.
- Rewording the #7192 changeset is right: it is still unconsumed on
main(no release since v0.6.6), so one note describes the behavior that ships. The 16px allowance applies only to the handle-then-off-sheet order and the spec says why.
[Automated review]
4 tasks done
cixzhang
pushed a commit
that referenced
this pull request
Oct 24, 2026
## User impact People who zoom a phone page to read it could not pinch-zoom from a list of swipeable rows: a pinch that started on an `Item` or `ListItem` with `swipeActions` did nothing, and in iOS Safari a sideways pinch swiped the row open. Such rows usually fill the screen. Now that pinch zooms the page and the row stays put, whichever finger lands first. One-finger swipes and scrolling are unchanged. ## Problem and solution fit - **Why does the pinch do nothing?** The row's `touch-action: pan-y` refuses pinch-zoom, and the swipe tracked only its first finger: a sideways pinch crossed the axis lock, so the row claimed it and cancelled `touchmove`. - **Why does that harm the task?** The rows leave no other surface to pinch. - **Why does it matter?** Zoom is how many readers resize text on a phone (WCAG 2.2 SC 1.4.4, AA). ## Expected behavior and authority - `spec:AST-020` FR1 (current): WCAG 2.2 A and AA, so SC 1.4.4 Resize Text. - `spec:AST-057` (current) is silent on `touch-action` and second fingers. - As BottomSheet (#7192, #7198) and MobileNav (#7193). ## Smallest restoration - `Item.tsx`: the swipe root declares `pan-y pinch-zoom`. - `useSwipeAction.ts`: a second touch landing before the axis is decided, anywhere on the page (a document listener, only while that touch is undecided), hands the touch to the browser. A non-first pointer never starts a swipe. A swipe under way keeps its finger. No new API, no visual change. ## Evidence iOS 26.2 simulator, Safari, a pinch on the first row (to 2.5×): main stays at 1.00× and swipes the row open; this change zooms to 2.00×, the row still (`touch-action` `pan-y` → `pan-y pinch-zoom`).  Chrome (phone emulation, CDP touch), zoom after the pinch, main → this change: sideways on the row 1.00× → 2.06× (row dragged 60 → 0 px); vertical across two rows 1.00× → 3.97×; one finger below the list, either order, 1.00× → 5.00×. `pinch-zoom` alone still dragged the row 15 px. - Reproduction: `ItemSwipePinchZoom.a11y.chromium.spec.ts` fails 4 of 4 pinch cases on main; 4 of 5 new unit tests fail on main's code; all pass after. - Unchanged: the one-finger case, `ItemSwipeActions.a11y.chromium.spec.ts`, the swipe unit tests; in iOS Safari a one-finger swipe still rests open. - Regression tests: the spec and the unit tests (second finger on/off the row, non-first finger, owned swipe, listener lifetime). ## Scope - [x] One defect is restored. - [x] Separable contradictory or unsettled tagalongs were removed or split. - [x] No new public API, visual representation, default, or interaction model is hidden under the bug-fix label. - [x] Public text and artifacts contain no internal Meta context. ## Testing - `pnpm exec vitest run packages/core/src/Item packages/core/src/List`: 159 passed. - `pnpm exec playwright test packages/core/src/Item/__tests__ --project=chromium` against main's Storybook build and this branch's build, as above. - iOS 26.2 simulator (iPhone 17 Pro), Safari, against both builds, as above. - CI runs the new spec in its own pr-a11y step in `ci.yml`; `pnpm exec vitest run .github/scripts/ci-test-routing.test.mjs .github/scripts/release-check-workflow.test.mjs`: 101 passed. - `pnpm -F @astryxdesign/core typecheck`, `pnpm check:changesets`, `pnpm check:sync`, `pnpm check:repo`; ESLint and Prettier on the touched files. ### Video per path Chromium, real touch (CDP), main left, this change right; dots are a page overlay drawn from the page's touch events: 
4 tasks done
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User impact
Follow-up to #7192. A pinch on an open BottomSheet now zooms the page, except when the fingers land in a particular order. If the first finger lands on the sheet's content and the second on the handle, the page does not zoom, and the sheet is dragged, or thrown away entirely (571px in real Chromium). Two other orders also moved the sheet: a lower finger first at the top of the content (24px), and a handle finger first with the second off the sheet (14px).
After this change, a pinch zooms the page and the sheet holds its detent, whichever finger lands first and wherever the second one lands.
Problem and solution fit
preventDefault()ed the zoom away.The fix is one hand-off,
yieldToPinch. It drops every armed gesture (content touch, content pointer) and any drag in flight. It is called whenever a second finger shows up:toucheslists more than one finger, which catches a second finger off the sheet.When the browser cancels a handle drag's pointer to take the pinch, the sheet now returns to its detent instead of settling from where the finger had got to.
Expected behavior and authority
spec:AST-020FR1 (current) and WCAG 2.2 SC 1.4.4. Same as fix(BottomSheet): leave pinch-zoom to the browser #7192.Smallest restoration
useSheetGestures.ts: addsyieldToPinch, and wires it into the handle and content pointer-down, the content touch listeners, and new handleonTouchStart/onTouchMove. A handlepointercancelnow callscancelDrag.Evidence
Real Chrome 155 (headless, phone emulation 390×844 @3×, CDP two-finger touch),
core-bottomsheet--text-only. The table shows the most the sheet moved while the fingers were down:BottomSheetPinchZoom.a11y.chromium.spec.ts(now 6 finger orders plus the one-finger check) fails 2 of 7 against the merged fix(BottomSheet): leave pinch-zoom to the browser #7192 build.useSheetGesturessuite.touches> 1);The one remaining transient (handle finger, then a finger off the sheet) is the browser's event order. The sheet cannot see a finger that lands off it until the handle finger's next touch event, and Chromium delivers that finger's pointermove first. The spec allows that one sample (under 16px) for that order only.
Scope
Testing
pnpm exec vitest run packages/core/src/BottomSheet: 254 passed.BottomSheetPinchZoom.a11y.chromium.spec.ts(Playwright, Chrome channel) against the merged fix(BottomSheet): leave pinch-zoom to the browser #7192 build and against this branch's build, as above.