Skip to content

fix(BottomSheet): a swipe that starts slowly on the sheet's content moves the sheet - #11140

Merged
imdreamrunner merged 1 commit into
mainfrom
fix/powersearch-drag-slow-start-fitting
Nov 11, 2026
Merged

imdreamrunner merged 1 commit into
mainfrom
fix/powersearch-drag-slow-start-fitting

Conversation

@imdreamrunner

@imdreamrunner imdreamrunner commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

User impact

On an iPhone, a person swipes down on a bottom sheet to close it. When nothing under the finger can scroll and the finger starts slowly, so that its first move is 8 px or less, the sheet does not follow the swipe. It stays open, or it jumps 9 to 30 px and falls back while the finger keeps pulling. A fast swipe closes the sheet, and so does a swipe that starts on the grab bar, so the same gesture works only some of the time.

This is every step of the PowerSearch sheet flow (Filters, Add filter, the value step) and the Tokenizer sheet that a list value opens: all four are sheets whose content fits. It is also the fixed header of a sheet whose list scrolls. At the top of a list that scrolls, the same thing happens when the finger wobbles up a pixel or two as it lands. The defect is in WebKit, which gives the page every touchmove. Chromium is not affected: it sends the page no touchmove inside its own touch slop, so the first move a page sees is already past 8 px.

Problem and solution fit

  1. Why does the swipe fail? A touch on content that fits arms both scroll edges: the top for a pull down, and the bottom for a pull up (fix(core): a BottomSheet pulled past its top stretches on every pull, on the iOS rubber band #8109 arms the bottom for content that fits, so that a pull up stretches the sheet). A move that left an armed edge was read as the content's scroll, and it disarmed both edges. On content that fits, a pull down always leaves the bottom edge. So a first move that was still under the 8 px drag slop disarmed the top edge too, and the pull never reached the sheet. A first move up did the same, on content that fits and at the top of a list.
  2. Why does that harm the task? After that move nothing owns the touch. The content has no scroll to take it, and the sheet no longer listens for the pull.
  3. Why does that matter? A swipe is how a person leaves a step of the PowerSearch flow, which has no Back action. A dismissal that answers only fast swipes reads as broken.

The fix has three parts, all in the body's touchmove hand-off:

  • An edge goes back to the native scroll only when the content has room to scroll that way. Content that fits has nothing to scroll, so both edges stay armed until the pull passes the drag slop, in either direction.
  • At the edge of a list that scrolls, a move away from the edge takes the touch for the scroll only once it passes a tap's wobble, 5 px. Mobile Safari commits no native pan on a kept move under 5 px (spec:AST-094 DEC-29), so nothing has changed hands before that. A pull down that follows a wobble up of 1 to 4 px still moves the sheet. A move up of 5 px or more scrolls the list, as before.
  • The first move past the 8 px drag slop on either axis decides the touch, once. A mostly vertical pull against an armed edge is the sheet's drag. A mostly sideways move is a row's scroll or swipe, and the sheet stops tracking that touch. Any other move is the content's scroll. Edges that stay armed must not hand the sheet a sideways swipe late: on main, a swipe along a row was safe on content that fits only because its first move disarmed both edges.

How the 5 px pan cancel (#10033) and this fix meet, for a pull straight down on content that fits:

First move Before After
under 5 px Kept, as a tap's wobble. Both edges disarmed: the pull is lost. Kept. Both edges stay armed: the next move past 5 px cancels the pan, and the drag starts past 8 px.
5 to 8 px Cancelled. Both edges disarmed: the pull is lost. Cancelled. Both edges stay armed: the drag starts past 8 px.
over 8 px Cancelled, and the drag starts. The same.

Expected behavior and authority

  • spec:AST-094 FR14: "If the area sits at its edge and the drag moves toward that edge, the surrounding surface (a sheet) takes the drag", decided "once, when the drag begins", and "The drag MUST NOT change hands midway". Content that fits sits at both edges. A move under a tap's wobble is not yet a drag.
  • spec:AST-094 FR20: "The main axis is the one the finger has moved farther along since touch-down, horizontal on a tie". A move whose main axis is horizontal is not a drag toward the top or bottom edge, so FR14 does not give it to the sheet.
  • spec:AST-094 FR17 and FR19: a pan begins at its slop of travel on either axis, and a recognizer that competes with native scrolling decides within 10 px of travel.
  • spec:AST-094 FR19, DEC-18 and DEC-29: a sheet's pull cancels its touch's moves once the pull reaches a tap's wobble, while every scroller under the finger sits at its edge and the drag moves toward that edge. A kept move of 5 px commits Mobile Safari to the native pan, and a kept move of 4 px commits nothing.
  • component:BottomSheet FR18: a pull on the sheet's body is the sheet's "once the content has no room left to scroll that way: content that fits stretches at once".
  • component:PowerSearch FR13, FR15a and FR21: a swipe dismisses the top sheet of the flow.
  • Regression history: before fix(core): a BottomSheet pulled past its top stretches on every pull, on the iOS rubber band #8109, content that fits at the tallest detent armed only its top edge, so a slow pull down kept that edge.

No record changes: the code now does what these clauses state.

Smallest restoration

The three conditions above, in one block of useSheetGestures.ts. No API, no visual, no default and no timing changes.

Behavior that changes on paths that worked on main, all from the once-only decision:

  • At the top of a list, a mostly sideways move that drifts more than 8 px down no longer starts the sheet's drag.
  • A pull whose first move past the slop is more sideways than down no longer moves the sheet for that touch. On main the sheet followed it. With the edges kept armed, the choice is between that and a sheet that jumps by the whole travel when the pull turns down.
  • On content that fits, a sideways move that later comes back up no longer starts the sheet's stretch.
  • A list that scrolled off its top before the pull passed the slop keeps the touch, and the sheet takes no later pull down from it.

Not in this change:

Evidence

  • Reproduction before the change: slow starts on the header and the content closed the sheet 0/64 times in Playwright WebKit, followed the finger 0/31 times in the iOS Simulator, and closed the sheet 0/32 times on the production build.
  • Result after the change: 64/64 in Playwright WebKit and 32/32 in the iOS Simulator.
  • Representative unchanged path: the grab bar, fast swipes, a list that scrolls, taps, and Chromium, below.
  • Regression test or other mutation-sensitive proof: 14 new unit tests fail on main and pass with the fix.

The page is Storybook's PowerSearch "Bottom sheet (forced)" story on a 402 x 714 phone viewport. Its four sheets are Tall sheets whose content fits. Every swipe is real touch input: WebKit's input command in Playwright WebKit, CDP touch in Chromium, and HID touches in the iOS Simulator (iOS 27.0, iPhone 17, Safari). A swipe starts on the grab bar, on the fixed header, or on a row of the content.

Which build each table measured: the first WebKit table and the Simulator table measured the first condition alone. The later conditions change no pull that travels straight down on content that fits. The WebKit re-run under that table, the Chromium counts, and the sideways table measured this head.

Playwright WebKit: a 400 px pull, then a lift. The count is the swipes that closed the sheet.

Slow start means a first move of 8 px or less: 3 px, 6 px, ten moves of 1 px, or 1 px up and then down. Fast start means a first move of 12 or 24 px. 144 swipes for each build.

Sheet Start Before, fast start Before, slow start After, fast start After, slow start
Filters grab bar 4/4 8/8 4/4 8/8
Filters header 4/4 0/8 4/4 8/8
Filters content 4/4 0/8 4/4 8/8
Add filter grab bar 4/4 8/8 4/4 8/8
Add filter header 4/4 0/8 4/4 8/8
Add filter content 4/4 0/8 4/4 8/8
Value step grab bar 4/4 8/8 4/4 8/8
Value step header 4/4 0/8 4/4 8/8
Value step content 4/4 0/8 4/4 8/8
Tokenizer sheet grab bar 4/4 8/8 4/4 8/8
Tokenizer sheet header 4/4 0/8 4/4 8/8
Tokenizer sheet content 4/4 0/8 4/4 8/8

By first move, header and content starts of all four sheets:

First move Before After
3 px (under the pan cancel) 0/16 16/16
6 px (between the pan cancel and the drag slop) 0/16 16/16
ten moves of 1 px 0/16 16/16
1 px up, then down 0/16 16/16
12 px 16/16 16/16
24 px 16/16 16/16

Before, 48 of the 64 failed swipes still moved the sheet 9 to 30 px before it fell back.

The same 144 swipes on this head, Playwright WebKit: 144/144 closed the sheet. That is 64/64 slow starts and 32/32 fast starts on the header and the content, and 48/48 on the grab bar.

iOS Simulator: a 120 px pull. The count is the swipes where the sheet was within 12 px of the finger at the lift.

48 swipes for each build, grouped by the first move the page saw.

Sheet Start Before, first move 8 px or less Before, over 8 px After, 8 px or less After, over 8 px
Filters header 0/4 2/2 4/4 2/2
Filters content 0/4 2/2 4/4 2/2
Add filter header 0/4 2/2 4/4 2/2
Add filter content 0/4 2/2 4/4 2/2
Value step header 0/4 2/2 4/4 2/2
Value step content 0/4 2/2 4/4 2/2
Tokenizer sheet header 0/3 3/3 4/4 2/2
Tokenizer sheet content 0/4 2/2 4/4 2/2
All 0/31 17/17 32/32 16/16

Before, by first move: under 5 px 0/13, 5 to 8 px 0/18. After: 15/15 and 17/17. Before, each failed swipe moved the sheet 10 to 18 px, and the sheet was back at rest at the lift.

The grab bar in the Simulator on main, Filters and the value step, first moves of 4 to 6 px and of 30 px: 8/8 followed. The grab bar's path is not changed.

Chromium

Playwright Chromium, the same swipes: 144/144 closed the sheet on main, and 72/72 on this head. Chromium held back every touchmove inside its touch slop: the first move the page saw was 16 px or more in every swipe, the slow starts included.

Sideways and diagonal moves

Playwright Chromium on Linux and Playwright WebKit on macOS, 3 runs for each cell in each engine. A finger starts on a row and moves as the first column says. The numbers are how far the sheet moved at most, and where it was at the lift, in px. The table shows Chromium; WebKit gave the same travel, and 1 to 3 px at the lift where Chromium gave 0 or 1.

Gesture Content main This head
A swipe 150 px along a row that drifts 40 px down fits 9, then 1 9, then 1
The same a list at its top 40, then 40 9, then 1
A swipe along a row that turns into a 160 px pull fits 9, then 1 9, then 1
The same a list at its top 160, then 160 9, then 1
A pull that begins more sideways than down, then turns down, 250 px fits 250, then 250 20, then 0
The same a list at its top 250, then 250 20, then 0
A pull that is mostly down from its first move, then drifts sideways, 160 px fits 160, then 160 160, then 160
The same a list at its top 160, then 160 160, then 160

The 9 and 20 px that remain are the short drag of the body's pointer path, which this change does not touch. With the edges kept armed but the axis read again on every move, the swipe that turns into a pull and the pull that begins sideways moved the sheet by the whole travel at once, 160 px and 169 px. The once-only decision removes that.

The production build

The same story on the production Storybook, in Playwright WebKit, 72 swipes: header and content starts closed the sheet on 0/32 slow starts and 16/16 fast starts, and the grab bar on 24/24. The published 0.7.13 sources of BottomSheet, PowerSearch and Tokenizer are the same as main's, so the defect is in the current release.

Representative unchanged paths

  • A list that scrolls (the realistic PowerSearch config's Add filter sheet), Playwright WebKit, swipes that start on a row with the list at its top: slow starts whose first move is down closed the sheet 6/6 before and 6/6 on this head. The fixed header above that list went from 0/8 to 8/8, as it has nothing to scroll. A first move of 1 px up, then a pull down: 0/2 before, and 2/2 on this head with the 5 px rule.
  • The grab bar and fast swipes: unchanged in every table above.
  • A tap: a move under 5 px is never cancelled, before or after, so a tap's wobble keeps its click. From 5 px, a modal sheet's scroll lock already cancelled the moves of a pan on content that fits: in the Simulator's runs on main, moves of 6 and 8 px were cancelled after both edges were disarmed. So in a modal sheet the fix cancels no move that main kept. In a non-modal sheet whose content fits, a tap that drifts 5 to 8 px toward an edge now loses its click on every such touch, not only when its first move is that long, which is the trade-off spec:AST-094 DEC-29 records.

Regression tests

useSheetGestures.test.ts, in "body touch handoff". 14 of these fail on main:

  • "content that fits": a pull down whose first move is 1, 4, 5 or 8 px; a pull that creeps a pixel at a time; a pull down after the finger drifts up; a pull up after the finger drifts down. Each also asserts which moves are cancelled, so the 5 px pan cancel stays covered on both sides of it.
  • A list at its edge: a wobble of 4 px away from the edge, then a pull, starts the drag. A move of exactly 5 px away gives the touch to the scroll, and the sheet takes no later pull. A disarm one pixel late fails the second pair.
  • A sideways swipe, on content that fits and at the top of a list: no move is cancelled and no drag starts, also when the swipe drifts down, turns into a pull, or comes back up.
  • A pull whose first move past the slop is more sideways than down starts no drag, also when it then turns down.
  • The decision waits for the drag slop: a first move of 6 px sideways and 5 px down decides nothing, the pull that follows starts the drag, and a sideways drift after that does not end it.
  • A list that is off its top when the pull passes the slop keeps the touch.

Each condition was also removed in turn, and each removal fails at least one of these tests.

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.

Testing

  • pnpm exec vitest run packages/core/src/BottomSheet/useSheetGestures.test.ts --project ui: 125 passed. With the source file at main: 14 failed, 111 passed.
  • pnpm exec vitest run packages/core/src/BottomSheet packages/core/src/PowerSearch packages/core/src/Tokenizer packages/core/src/internal packages/core/src/hooks --project ui: 100 files, 2,475 tests passed.
  • pnpm exec prettier --check and pnpm exec eslint on the changed files, pnpm check:changesets.
  • Real engines, as in Evidence: Playwright WebKit and Chromium on a phone viewport with touch, and Safari in the iOS 27.0 Simulator.
  • Not measured in the iOS Simulator: a full pull that closes the sheet, the grab bar after the change, a tap that drifts, and the second and third conditions. Playwright WebKit covers all but the tap on this head. The tap is argued from the scroll lock's 5 px hold. The 5 px rule rests on DEC-29's measurement, which Playwright WebKit cannot repeat because it commits no native pan.

@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 3:19am 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, 3:32 AM UTC

@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.

Requesting changes. Keeping both edges armed on content that fits fixes slow swipes in WebKit, and the new tests fail on main and pass here, but two things need fixing first:

  • A sideways swipe along a row in a sheet whose content fits now starts the sheet's drag once it drifts 9 px down, because the promotion in useSheetGestures.ts checks only vertical travel (in a Chromium touch run the sheet followed the drift 40 px on this branch and 0 px on main), which spec:AST-094 FR14 and FR20 rule out; please promote only a mostly vertical move, as the cancel already requires, and add a test for that swipe.
  • The changeset says the defect happened "on a touch screen", but your own Chromium runs closed the sheet 144 of 144 times before the change, so it should name WebKit browsers (Safari, and every browser on iPhone and iPad) instead.

Non-blocking: the list-at-top guard test drifts 3 px first, below the pan WebKit commits (spec:AST-094 DEC-29); a 6 px drift would pin the case FR14 settles.

Automated review (maintainer link)

github-actions Bot added a commit that referenced this pull request Nov 11, 2026
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · ca30677

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
BottomSheet 69.3 kB (+62 B) · 7.7 kB CSS (0) — ✗ · ✓ · —
BottomSheetSwitcher 18.6 kB (0) · 3.4 kB CSS (0) — ✗ · ✓ · —
DateInput 189.6 kB (+64 B) · 17.1 kB CSS (0) — — · — · —
22 more components
Component Size LoC Visual · A11y · RTL
PowerSearch 293.1 kB (+58 B) · 24.2 kB CSS (0) — — · — · —
DateTimeInput 211.7 kB (+57 B) · 18.7 kB CSS (0) — — · — · —
TimeInput 164.7 kB (+30 B) · 16.1 kB CSS (0) — — · — · —
Tokenizer 94.8 kB (+1 B) · 18.8 kB CSS (0) — — · — · —
ContextMenu 111.0 kB (0) · 17.5 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) — — · — · —
TableCell 112.2 kB (0) · 17.9 kB CSS (0) — — · — · —
TableHeaderCell 111.8 kB (0) · 17.7 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/TourStep 99.2 kB (0) · 590 B CSS (0) — — · — · —
richtext/RichTextEditorToolbar 281.3 kB (0) · 454 B CSS (0) — — · — · —
DropdownMenu 99.1 kB (−1 B) · 17.6 kB CSS (0) — — · — · —
Markdown 190.8 kB (−1 B) · 20.8 kB CSS (0) — — · — · —
lab/ChatEmojiPicker 108.2 kB (−1 B) · 773 B CSS (0) — — · — · —
lab/CommentThread 348.6 kB (−1 B) · 2.4 kB 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 (+498 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.

Requesting changes. The slow-start fix works: the new tests fail on main and pass here, and the sideways-drift and changeset points from the last round are fixed. One blocking issue remains:

  • Because the mostly-vertical test is re-read on every move against travel since touch-down (useSheetGestures.ts:1758-1775), a pull that begins more sideways than down reaches the sheet only when its vertical travel overtakes, and the sheet then jumps the whole travel (in Chromium a diagonal pull left the sheet still for 120 px and then moved it 130 px in one frame, where main follows from 10 px, and a chip-row swipe that turns into a pull jumped a fitting sheet 155 px after the browser had taken the touch), which goes against spec:AST-094 FR14 ("decided once, when the drag begins", no change of hands midway) and FR20; decide the axis once at the first move past the slop and stop tracking a sideways touch (or start the drag where the pull turned vertical and drop it on an uncancelable sideways move), and update the test at useSheetGestures.test.ts:1818 and the changeset's "A list that scrolls keeps its behavior" to match.

Automated review (maintainer link)

…oves the sheet

In WebKit, a touch on a sheet whose content fits arms both scroll edges. A
first move of 8 px or less disarmed both edges, so the pull never reached
the sheet: the sheet stayed open, or jumped a few pixels and fell back. A
fast swipe, or a swipe on the grab bar, still worked.

An edge now goes back to the native scroll only when the content has room
to scroll that way. Content that fits has nothing to scroll, so both edges
stay armed until the pull passes the drag slop.

At the edge of a list that scrolls, a move away from the edge takes the
touch for the scroll only once it passes a tap's wobble, 5 px. A shorter
move commits no native pan, so a pull down that follows a small wobble up
still moves the sheet.

The first move past the drag slop on either axis now decides the touch,
once. A mostly vertical pull against an armed edge is the sheet's drag. A
mostly sideways move is the row's for the rest of the touch. Any other
move is the content's scroll. So a swipe along a row that drifts, or that
turns into a pull, never moves the sheet late.
@imdreamrunner
imdreamrunner force-pushed the fix/powersearch-drag-slow-start-fitting branch from 3ed97c9 to ca30677 Compare November 11, 2026 03:05
@imdreamrunner imdreamrunner changed the title fix(BottomSheet): a swipe that starts slowly on content that fits moves the sheet fix(BottomSheet): a swipe that starts slowly on the sheet's content moves the sheet Nov 11, 2026

@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 pending CI: CI has not finished on this head yet.

The slow-start fix restores the sheet's pull on content that fits: the new tests fail on main and pass here, and a pull that starts more sideways than down no longer jumps the sheet late, which resolves the last round's blocking point.

  • Non-blocking: the description still says a pull that begins sideways starts the drag once its vertical travel is the larger one, and quotes the earlier test counts, while the head drops a touch whose first move past the 8 px slop is mostly sideways (useSheetGestures.ts:1797-1801); please update it to match the changeset.

Automated review (maintainer link)

github-actions Bot added a commit that referenced this pull request Nov 11, 2026
@imdreamrunner
imdreamrunner merged commit 39819bf into main Nov 11, 2026
73 checks passed
@github-actions
github-actions Bot deleted the fix/powersearch-drag-slow-start-fitting branch November 12, 2026 06:06

This branch was successfully deployed

1 active deployment
Preview — ca30677f 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