Skip to content

fix(BottomSheet): a finger's pull on the sheet's content is one touch drag from its touch-down, so a short flick closes the sheet - #11145

Merged
imdreamrunner merged 1 commit into
mainfrom
fix/powersearch-drag-release-cancel
Nov 11, 2026
Merged

imdreamrunner merged 1 commit into
mainfrom
fix/powersearch-drag-release-cancel

Conversation

@imdreamrunner

@imdreamrunner imdreamrunner commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

User impact

On a phone, a fast flick down on a sheet's content sometimes closes the sheet and sometimes springs it back. It springs back when the page receives the flick as two or three touchmoves, which a short flick at a 60 Hz touch rate often is. The same flick on the grab handle closes the sheet every time. This affects BottomSheet and the sheets that Tokenizer and PowerSearch open (PowerSearch's Filters sheet, the Add filter sheet above it, and the value step above that).

The same cause makes every pull on the content begin twice. The sheet's pointer handlers begin the drag, a pointer capture change cancels it one move later, and the touch listeners begin it again. On content that fits (the PowerSearch and Tokenizer sheets), a pull that starts slowly is not begun again: the sheet moves 10 to 20 px with the finger, returns to rest, and stays there while the finger keeps pulling. In Chromium the content's own pan can start under the drag.

Problem and solution fit

Why does it occur:

  1. A finger's pull is begun on the wrong path. A finger raises a pointer event before each touch event. The content's pointer handlers serve a mouse or a pen, but they arm for a finger too and promote at the same 8 px as the touch listeners, one event earlier. That drag calls setPointerCapture on the content element. A touch pointer is already captured by the element under the finger, so moving the capture raises lostpointercapture on that element. The event bubbles through the content, and the handler that guards a mouse drag cancels the drag one move later. Mobile Safari uses the touch identifier as the pointer id; Chromium uses another number, so there the touch listener finds no touch for the pointer's drag, keeps the touchmove, and the content's native pan can start.
  2. The release forgets the start of the pull. The velocity tracker is created when the drag begins, past the 8 px slop, and again when the drag is begun the second time. A release needs two moved samples after that. A flick of two or three moves has one or none, so it reads 0 px/s and settles on the nearest position, which is open.

Why does it harm the task: the same flick closes the sheet from the grab handle and not from the content, and whether it closes depends on how many moves the browser delivered, which a person cannot see. So a swipe down "sometimes works".

Why does it matter: a flick on the content is the most common way to dismiss a sheet on a phone.

The fix makes a finger's pull on the content one touch drag from its touch-down: the touch-down drops the pointer handlers' arm, and the contact's positions are tracked from the touch-down and handed to the drag when it begins.

Expected behavior and authority

  • spec:AST-094 FR19: "A recognizer that begins MUST claim its touches by cancelling touchmove through a non-passive listener on its element." The pointer handlers' drag left a finger's touchmove uncancelled in Chromium, and took the drag away from the listener that claims the touch.
  • spec:AST-094 FR36: "A drag that can commit an action MUST decide once, when the finger lifts." The pointer handlers' drag ended on a pointer capture change, with no lift.
  • spec:AST-100 FR2: "The velocity a component reads when the contact lifts is the velocity iOS reports for the same motion: a pan's velocity for a dragged surface." FR1: "components of the same kind report the same velocity for the same contact motion." FR4: "the same motion gives the same velocity for touch, pen, and mouse pointers." architecture:interaction-modality INV10: one tracker "owns a gesture's pointer samples". A pull on the content read a different velocity from the same pull on the grab handle, whose tracker starts at the press.
  • component:BottomSheet FR19 decides what a release does with that velocity (from 1,008 px/s a touch release is a flick, and "a flick at the lowest detent closes the sheet"). Those rules and their values are unchanged.

No knowledge record changes: the records already state this behavior.

Smallest restoration

Two edits in useSheetGestures.ts:

  • The content's touchstart listener drops the pointer handlers' arm. A contact that raises touch events is the touch listeners' drag; a mouse or a pen, which raises none, keeps the pointer handlers.
  • The armed touch and the armed pointer each keep a VelocityTracker from the contact's start, and beginDrag takes it. The grab handle's drag is unchanged: its tracker already starts at the press.

No API, no visual change, no change to a threshold, the slop, the pan cancel, or the release rule.

Evidence

Setup: Storybook builds of main (a21f2ee) and of this change. Playwright WebKit and Chromium on a 402 × 714 touch phone profile, with real touch input (WebKit's input command; Chromium CDP with scripted timestamps). Mobile Safari 27.0 in the iOS 27.0 simulator (iPhone 17) with HID swipes, for main. Sheets: a plain tall sheet whose list scrolls (core-bottomsheet--tall-sheet) and the three PowerSearch steps (core-powersearch--sheet-presentation): Filters, Add filter above it, the value step above that. Each sheet is 657 px tall on screen. Start points: the grab handle, the header, a row or the list, the footer. The page logged every pointer and touch event, each setPointerCapture, and the sheet's position per frame.

1. A fast flick on the content, 150 px, sheets closed / flicks. The page read every flick at 1,700 px/s or more from the touch-down; a touch release is a flick from 1,008 px/s.

Start point WebKit, 2 or 3 moves: main this change Chromium, 3 moves: main this change
Plain tall sheet, list 0/8 8/8 0/4 4/4
Filters, header 0/8 8/8 0/4 4/4
Filters, row 0/8 8/8 0/4 4/4
Filters, footer 0/8 8/8 0/4 4/4
Add filter, header 0/8 8/8 0/4 4/4
Add filter, row n/a n/a 0/4 4/4
Value step, header 0/8 8/8 0/4 4/4
Value step, list 0/8 8/8 0/4 4/4
All content starts 0/56 56/56 0/32 32/32
Grab handle, all four sheets 32/32 32/32 16/16 16/16

(In WebKit the Add filter row's point lands on the grab handle's band, so it is not a content start there.) Flicks of 4 or 5 moves close on both builds: WebKit 35/35 and 35/35, Chromium 40/40 and 40/40. A 2-move flick in Chromium closes on neither build (0/32 and 0/32): Chromium keeps the first touchmove inside its own touch slop from the page, so one move arrives and there is no velocity to read.

2. Pointer capture on the content element, pulls and flicks that took it / all.

Engine main this change
WebKit 119/119 0/119
Chromium 136/136 0/136
Mobile Safari, iOS simulator 19/19 0/1

Each of them shows the same order on main: pointermove (the pointer handlers begin the drag, setPointerCapture), then lostpointercapture on the element under the finger and gotpointercapture on the content, then the touch listeners begin the drag again. In Mobile Safari the pointer id equals the touch identifier in all 19. In Chromium, 2 of the 136 ended in pointercancel with 20 to 25 uncancelable touchmoves under the drag; 0 with this change.

3. A pull that starts slowly on content that fits (first moves 3, 6, 10, 15 px from the touch-down, or a 7 px first move in the simulator).

  • main, WebKit: 12 of 12 pulls on PowerSearch content moved the sheet 10 px, then the sheet sat at rest for 55 to 70 frames of the pull. 0 of 6 pulls of 420 px closed it.
  • main, Mobile Safari in the iOS simulator: 7 of 8 moved the sheet 14 to 21 px and then it sat at rest for 32 to 72 frames of a 300 px pull; 1 never moved. The 6 pulls whose first delivered move was more than 8 px followed the finger. So did 5 of 5 on the plain tall sheet.
  • This change: the sheet no longer moves and returns. It does not move at all (12 of 12), because the touch listeners disarm both scroll edges on a slow first move over content that fits. That is a separate defect, and fix(BottomSheet): a swipe that starts slowly on the sheet's content moves the sheet #11140 fixes it. The two changes edit different lines and merge cleanly, and useSheetGestures.test.ts passes with both applied (123 tests).
  • With a local patch that keeps the top edge armed, as fix(BottomSheet): a swipe that starts slowly on the sheet's content moves the sheet #11140 does: on main plus that patch, 12 of 12 follow the finger and 6 of 6 close, but all still take pointer capture and are begun twice, and 2- and 3-move flicks still spring back (0/12). With that patch and this change: 12 of 12 follow, 6 of 6 close, 0 captures, and 2- and 3-move flicks close (12/12).

Representative unchanged path. 187 scripted releases on the tall sheet and the Filters sheet (Chromium, from the grab handle and the content), compared pair by pair on the two builds, give the same result in 185. One of the two that differ is a 1,100 px/s content flick that the page received as three moves, which now closes. The other is a release from the grab handle, whose path this change does not touch, with a last sample 1 px back; it sits on the sign test of spec:AST-094 FR37 and went either way on both builds. On both builds:

  • A slow pull that stops, rests 200 ms and lifts: 320 px returns (0/6 close), 340 px closes (6/6). Halfway is 328 px.
  • A pull at 400 to 900 px/s lifted while it moves closes at 300 px (6/6) and returns at 200 px (0/6).
  • A 1,140 px/s pull of 200 px closes after a rest of 30 ms or less, and returns after 45 ms or more.
  • A 450 px pull that slows to a stop and whose last sample is 3 px back toward the start returns (0/14 and 0/9 close), as FR37 states.

In WebKit, a touchcancel during a pull, a window blur during a pull, and a pull with the Add filter search field focused end the same way on both builds.

Regression tests.

  • useSheetGestures.test.ts, four new cases that fail on main: a finger that raises pointer events takes no pointer capture and keeps its pull through lostpointercapture; a finger whose pointer id is not its touch identifier has every move cancelled; a content flick of two moves closes the sheet; a quick mouse pull from the content releases at the speed of the whole pull. One more case holds a slow two-move pull short of halfway open.
  • BottomSheetBodyPull.interaction.browser.spec.ts, real touch input, in the pull request's interaction lane on both engines:
    • A pull down on content that fits, with a slow start and with a start past the slop (Chromium and WebKit). The sheet's content takes no pointer capture, the element under the finger loses the pointer's capture only at the lift, and the sheet never steps back toward rest under a finger that only moves down. A start past the slop follows the finger for the whole 120 px.
    • A three-move flick on a list that scrolls closes the sheet (Chromium, whose touches carry the script's timestamps; skipped in WebKit, which stamps a touch when it arrives).
    • On a main Storybook: Chromium 3 of 3 fail, WebKit 2 of 2 fail. With this change: Chromium 3 of 3 pass, WebKit 2 of 2 pass.

Scope

Components: BottomSheet

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

One defect: a finger's pull on the content was not one touch drag from its touch-down. A mouse or pen pull from the content takes the same tracker hand-off, so it also releases at the speed of the whole pull (spec:AST-100 FR4); its release rule is unchanged.

Not in this change, measured and left as the records state them: a slow first move over content that fits (#11140); the release values; and FR37's rule that a release moving back toward the start cancels, whatever its speed. A last sample 1 px back was enough to return a 450 px pull in 17 of 22 trials across the two builds.

Testing

  • pnpm exec vitest run packages/core/src/BottomSheet packages/core/src/PowerSearch/PowerSearchBottomSheet.test.tsx (15 files, 785 tests)
  • pnpm -F @astryxdesign/core typecheck, eslint and prettier --check on the changed files, pnpm check:knowledge, pnpm review:pre (0 findings)
  • pnpm exec playwright test -c playwright.interaction.config.ts BottomSheetBodyPull against a Storybook of main (Chromium 3 fail, WebKit 2 fail) and of this change (Chromium 3 pass; WebKit 2 pass, 1 skipped)
  • Playwright WebKit and Chromium touch runs as above: 432 repeated flicks on the two builds, 704 pulls and flicks across four builds, 495 scripted releases. Mobile Safari in the iOS simulator on main (19 pulls) and one pull on this change. An iOS Simulator run of this change is pending; Playwright WebKit covers it here.

@vercel

vercel Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 11, 2026 2:13am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 11, 2026
@astracat-bot

astracat-bot Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 11, 2026, 2:29 AM UTC

… drag from its touch-down, so a short flick closes the sheet

A finger raises a pointer event before each touch event. The content's
pointer handlers, which serve a mouse or a pen, armed for the finger too and
began the drag first, at the same 8 px as the touch listeners. That drag took
pointer capture for the content element. Moving the capture off the element
under the finger raises lostpointercapture, which bubbles through the content
and cancelled the drag one move later. The touch listeners then began the drag
again with a new velocity tracker. In Chromium, whose pointer id is not the
touch identifier, the touch listener found no touch for the pointer's drag,
kept the move, and the content's own pan could start under the drag.

The release speed counted only the moves after the drag began. A fast flick on
the content that the page received as two or three moves read as no speed and
sprang back, where the same flick on the grab handle closed the sheet.

The content's touch-down now drops the pointer handlers' arm, so the touch
listeners alone drag for a finger. The contact's positions are tracked from
its touch-down, or its mouse press, and handed to the drag when it begins, as
the grab handle's drag has them. No release threshold changes.
@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · d1e3f62

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
BottomSheet 69.3 kB (+72 B) · 7.7 kB CSS (0) — ✗ · ✓ · —
BottomSheetSwitcher 18.6 kB (0) · 3.4 kB CSS (0) — ✗ · ✓ · —
DateInput 189.6 kB (+76 B) · 17.1 kB CSS (0) — — · — · —
22 more components
Component Size LoC Visual · A11y · RTL
DateTimeInput 211.7 kB (+70 B) · 18.7 kB CSS (0) — — · — · —
PowerSearch 292.8 kB (+67 B) · 24.2 kB CSS (0) — — · — · —
TimeInput 164.8 kB (+67 B) · 16.1 kB CSS (0) — — · — · —
TableCell 112.2 kB (+1 B) · 17.9 kB CSS (0) — — · — · —
ContextMenu 111.0 kB (0) · 17.5 kB CSS (0) — — · — · —
DropdownMenu 99.1 kB (0) · 17.6 kB CSS (0) — — · — · —
Markdown 190.8 kB (0) · 20.8 kB CSS (0) — — · — · —
MoreMenu 99.3 kB (0) · 17.6 kB CSS (0) — — · — · —
MultiSelector 97.0 kB (0) · 16.9 kB CSS (0) — — · — · —
Pagination 112.5 kB (0) · 17.8 kB CSS (0) — — · — · —
Popover 93.0 kB (0) · 14.2 kB CSS (0) — — · — · —
Selector 102.4 kB (0) · 17.4 kB CSS (0) — — · — · —
Table 127.8 kB (0) · 18.4 kB CSS (0) — — · — · —
TableHeaderCell 111.8 kB (0) · 17.7 kB CSS (0) — — · — · —
Tokenizer 94.5 kB (0) · 18.8 kB CSS (0) — — · — · —
lab/ChatReactionBar 109.4 kB (0) · 1.1 kB CSS (0) — — · — · —
lab/CommentComposer 154.4 kB (0) · 1.9 kB CSS (0) — — · — · —
lab/Comments 355.5 kB (0) · 2.5 kB CSS (0) — — · — · —
lab/CommentThread 348.6 kB (0) · 2.4 kB CSS (0) — — · — · —
lab/TourStep 99.2 kB (0) · 590 B CSS (0) — — · — · —
lab/ChatEmojiPicker 108.2 kB (−1 B) · 773 B CSS (0) — — · — · —
richtext/RichTextEditorToolbar 281.3 kB (−2 B) · 454 B CSS (0) — — · — · —
Visual changes: 2 snapshots in 1 component

A change is a question for the reviewer, not a failure.

Component · story Before After Diff
BottomSheet · Text Only (neutral, dark) before frame after frame diff frame
BottomSheet · Text Only (neutral, light) before frame after frame diff frame

Package size: @astryxdesign/core 7.30 MB packed (+484 B); no new dependencies.

API changes: none in this pull request

Committed API report behind this build: cli 68 rows, core 36 rows; run pnpm api:report.

Touched components checked; add ci:run-visual, ci:run-a11y or ci:run-rtl to run the full suites.


Generated by PR Enrichment workflow | View full report

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. A finger's pull on the sheet's content is now one touch drag from its touch-down, and the release counts the whole motion, which restores the touch-claim and release-velocity behavior the current records describe. The four new unit tests fail on main and pass here, and CI is green.

Nothing blocks. Two optional comment rewordings are left inline in useSheetGestures.ts. A pull that starts slowly on content that fits still does not move the sheet until #11140 lands.

Automated review (maintainer link)

Comment on lines +1517 to +1519
// Pointer path for the body at-top pull-down, for a mouse or a pen. A
// finger's drag belongs to the non-passive touch listeners below, so its
// touch-down drops this arm.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional wording (non-blocking): an Apple Pencil raises touch events too (see touchPointerType), so its touch-down also drops this arm. Suggested:

// Pointer path for the body at-top pull-down, for a contact that raises no
// touch events: a mouse, or a pen that raises none.

Comment on lines +1680 to +1684
// A finger raises pointer events before its touch events, so the
// pointer path arms for it too. That path begins the drag first and
// takes pointer capture from the element under the finger. The capture
// change then cancels the drag. So a contact that raises touch events
// belongs to this path.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional wording (non-blocking): with the next line in place, the pointer path no longer begins the drag for a finger, so the present tense reads as current behavior. Suggested:

// A finger raises pointer events before its touch events, so the pointer
// path arms for it too. Its pointer capture would cancel the drag. This path
// owns every contact that raises touch events.

@imdreamrunner
imdreamrunner merged commit 6d89442 into main Nov 11, 2026
73 checks passed
@github-actions
github-actions Bot deleted the fix/powersearch-drag-release-cancel branch November 12, 2026 06:06

This branch was successfully deployed

1 active deployment
Preview — d1e3f626 Deployed Nov 11, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant