Skip to content

fix(core): end a mouse drag a sandboxed frame never saw released - #12349

Closed
josephfarina wants to merge 3 commits into
mainfrom
rl-19-gesture-missed-up
Closed

josephfarina wants to merge 3 commits into
mainfrom
rl-19-gesture-missed-up

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

User impact

In Chromium, when a page is shown inside a sandboxed frame (an embed or a viewer), a mouse drag on a Slider thumb or a pan that is released outside the browser window never ends. A top-level page is not affected: it receives the pointerup and ends the drag already. The frame never receives the pointerup, so the gesture stays held. The thumb then follows the pointer when it comes back with no button down, and the Slider keeps its value tooltip forced open, so Escape cannot close it.

Problem and solution fit

  1. Why does it happen? The gesture host tracks a mouse press through the window's pointer events only. A button let go outside the window over a sandboxed (opaque-origin) frame sends its pointerup to the top page alone. Pointer capture on the pressed element does not route it to the frame either.
  2. Why does it hurt? The press outlives its release: the drag keeps driving whatever it held.
  3. Why does it matter? Embedded pages are a supported surface, and the stuck state looks like a broken control.

The browser still reports the truth on the next event: a pointermove whose buttons no longer has the primary button, or a new pointerdown. The host now ends the tracked mouse contact there, as a lift at its last place, at that event's time. No click follows such a lift, so none is guarded or replayed.

Expected behavior and authority

A press ends with its release (the gesture host's press lifecycle; spec:AST-094 FR44 already ends every press a lost focus or a cancel interrupts). This change covers the release the document never hears. No record changes.

Smallest restoration

One private method in GestureHost, called from onPointerMove and onPointerDown, for mouse contacts only. A chorded second button keeps the press. Touch and pen are unchanged.

Evidence

  • Reproduction before the change: in a sandboxed frame that fills the window, drag a Slider thumb, release outside the window, and move back over the frame with no button down. The thumb goes from 90 to 64 as the pointer comes back.
  • Result after the change: the thumb stays at 90, and the drag ends at the first move back over the frame.
  • Representative unchanged paths: a normal mouse drag ends at its pointerup as before; a press held with a second button keeps going; touch and pen paths are untouched.
  • Regression tests:
    • GestureHost.test.ts: a missed release ends at the next button-up move, at the press's last place.
    • GestureHost.test.ts: a missed release ends before the next press starts.
    • GestureHost.test.ts: a chord keeps the press.
    • SliderFramedRelease.interaction.browser.spec.ts: the sandboxed-frame Slider drag above. It runs in the full Chromium build (channel: 'chromium'), because Playwright's headless shell delivers the frame's pointerup and so cannot show the bug. In that build it fails on main and passes here.

Scope

Components: GestureHost (gestures), Slider tests

  • 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

  • vitest --project ui over gestures, Slider, BottomSheet, Carousel, Drawer, and List: 2,079 tests pass (gestures and Slider re-run on this head: 1,089).
  • Playwright interaction specs for Slider and gestures in Chromium: 117 pass.
  • The new browser test, in the full Chromium build, fails against a Storybook built from main (Expected: 90, Received: 64) and passes against this branch. All runs used CI=1.

@vercel

vercel Bot commented Nov 17, 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 17, 2026 6:08pm UTC

Request Review

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

astracat-bot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 17, 2026, 7:11 PM UTC

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · b8330f3

Storybook · Sandbox · built from this PR's head

Current run: The current CI run concluded cancelled. Current analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

@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 GestureHost fix itself looks right: it restores the mouse drag's release that the Slider and gesture specs require, and the two new GestureHost.test.ts end tests fail on main and pass here. Two things need fixing first:

  • The release note (.changeset/gesture-missed-mouse-lift.md) and the title say a drag released outside the page stayed held, but on main a top-level page already ends that drag at its pointerup, so please scope both to a page in a sandboxed frame released outside the browser window (wording suggested inline).
  • The new sandboxed-frame test in SliderFinePointer.interaction.browser.spec.ts passes on main under the config's chromium project, because Playwright's headless shell delivers the frame's pointerup, and fails on main (90 vs 64) only in the full Chromium build, so please pin it to that build (for example test.use({channel: 'chromium'}) in a describe that skips outside Chromium) or otherwise make it fail on main where CI runs it, and name the build in the description.

Optional: the new JSDoc on endMissedMouseLift could be shorter and name only the case the tests reproduce (suggestion inline).

Claims and files checked

Review mode: full; reason: no-earlier-review

  • Claims:
    • Release note, a drag released outside the page now ends when the pointer returns or presses: verified for a page in a sandboxed frame (GestureHost.ts:3797, :3890-3892, :3940-3962; the new end tests); false for a top-level page, which already ends the drag on main.
    • Release note, a Slider thumb, a pan or a sheet stayed held before: verified for the Slider in a sandboxed frame (full Chromium, 90 to 64) and for a pan (unit test); a sheet was not reproduced; false for a top-level page.
    • Description, in a sandboxed frame the release outside the window never arrives and the thumb follows a pointer with no button down: verified in the full Chromium build; Playwright's headless shell delivers the release.
    • Description, the contact ends as a lift at its last place at that event's time, with no click guarded: verified (GestureHost.ts:3953-3960; first new unit test).
    • Description, mouse only, a chord keeps the press, touch and pen unchanged: verified (GestureHost.ts:3941-3946; chord test).
    • Description, one private method, no new public API, no record change: verified (the built API surface of Core and the seven themes is unchanged).
    • Description, pointer capture does not route the release to the frame: not checked; the gesture host sets no pointer capture.
    • Description, the new unit tests fail on main and pass here: verified for the two end tests; the chord test passes on both, as a guard.
    • Description, the new browser test fails on main and passes here: false under the config's chromium project, where it passes on main; true only in the full Chromium build.
    • Description, the unit suites for gestures, Slider, BottomSheet, Carousel, Drawer and List pass: verified at this head.
    • Description, the Slider and gesture interaction specs pass in Chromium: verified, 117 pass and 5 skip in the config's chromium project at this head.
  • Files:
    • .changeset/gesture-missed-mouse-lift.md: finding (claim scope).
    • packages/core/src/gestures/GestureHost.ts: clear (optional comment suggestion).
    • packages/core/src/gestures/__tests__/GestureHost.test.ts: clear.
    • packages/core/src/Slider/__tests__/SliderFinePointer.interaction.browser.spec.ts: finding (passes on main under the chromium project).

Automated review (maintainer link)

Comment thread .changeset/gesture-missed-mouse-lift.md Resolved
@josephfarina josephfarina changed the title fix(core): end a mouse press whose release went outside the page fix(core): end a mouse drag a sandboxed frame never saw released Nov 17, 2026
@josephfarina
josephfarina marked this pull request as ready for review November 17, 2026 17:25

@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 earlier points are fixed: the release note and title now name the sandboxed-frame case, and the new SliderFramedRelease test fails on main (Expected 90, Received 64) and passes here under CI's Chromium project. One wording fix remains:

  • Miss: The release note (.changeset/gesture-missed-mouse-lift.md) says a sheet stayed held and followed the pointer, and the description's User impact says a sheet's drag never ends, but BottomSheet's drag does not go through GestureHost and already ends on main when the pointer comes back over the frame, so please drop the sheet from both (the phrase came from the wording suggested in the earlier review; a corrected line is inline).
Claims and files checked

Review mode: incremental; reason: none

  • Changed rules (0): none.
  • Claims:
    • Release note, a sandboxed-frame drag released outside the window now ends when the pointer comes back or presses again: verified (GestureHost.ts:3797, :3890-3892, :3937-3959; GestureHost.test.ts:2796, :2841; SliderFramedRelease.interaction.browser.spec.ts:27).
    • Release note, a Slider thumb, a pan or a sheet stayed held and followed the pointer before: verified for the Slider (99 to 30 on main) and a pan (unit test); false for BottomSheet, which ends when the pointer returns on main and is unchanged here.
    • Title, the fix ends a drag a sandboxed frame never saw released: verified.
    • Description, such a drag never ends for a Slider thumb, a pan or a sheet: verified for the Slider and host pans in Chromium's full build; false for a sheet.
    • Description, a top-level page already ends the drag: verified by the earlier probe; the runtime code is unchanged since apart from a comment.
    • Description, the Slider keeps its value tooltip shown so Escape cannot close it: tooltip shown in the base clip; Escape not checked.
    • Description, the host ends a mouse contact only on the window's pointer events and the release goes to the top page: verified (only pointerup, pointercancel and blur end a mouse contact on main; the frame hears no pointerup in the full build).
    • Description, pointer capture does not route the release to the frame: not checked; the host takes no pointer capture.
    • Description, the contact ends at the next buttonless move or press, as a lift at its last place, with no click guarded: verified (GestureHost.ts:3937-3959; first new unit test).
    • Description, a lost focus or a cancel already ends a press, and no record changes: verified (the cited clause covers blur and cancel; no record changed).
    • Description, one private method, mouse only, a chord keeps the press, touch and pen unchanged: verified (GestureHost.ts:3938-3943; GestureHost.test.ts:2876).
    • Description, 90 to 64 before and 90 kept after: verified at this head.
    • Description, a normal mouse drag still ends at its pointerup: verified (257 of 257 GestureHost tests pass).
    • Description, the three unit tests and the full-build browser test fail on main and pass here: verified for the two end tests and the browser test; the chord test passes on both, as a guard.
    • Description, no new public API and no internal context in public text: verified (built API surface unchanged; public text scanned).
    • Description, 2,079 unit tests over six folders and 1,089 over gestures and Slider pass: verified.
    • Description, 117 Slider and gesture interaction tests pass in Chromium: verified (117 passed, 5 skipped).
  • Files:
    • .changeset/gesture-missed-mouse-lift.md: finding (names a sheet).
    • packages/core/src/Slider/__tests__/SliderFramedRelease.interaction.browser.spec.ts: clear.
    • packages/core/src/gestures/GestureHost.ts: clear.
    • packages/core/src/gestures/__tests__/GestureHost.test.ts: clear.

Automated review (maintainer link)

Comment thread .changeset/gesture-missed-mouse-lift.md Resolved

@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 run on this head yet, because its run was cancelled at admission before the test, build and interaction jobs started, so please re-run CI on this head; the merge guard needs it green.

The GestureHost change ends a mouse drag whose release a sandboxed frame never hears, the new unit tests and the full-Chromium browser test fail on main and pass here, and every earlier point is fixed, including the release note, which now names only the Slider thumb and the pan that the tests reproduce.

Claims and files checked

Review mode: incremental; reason: none

  • Changed rules (0): none.
  • Claims:
    • Release note, a sandboxed-frame mouse drag released outside the window now ends when the pointer comes back over the frame or presses again: verified (GestureHost.ts:3797, :3890-3892, :3937-3959; GestureHost.test.ts:2796, :2841; SliderFramedRelease.interaction.browser.spec.ts:27).
    • Release note, before the fix a Slider thumb or a pan stayed held and followed the buttonless pointer: verified (90 to 64 on main in the browser test; the pan follows the buttonless move in the first new unit test on main).
    • Title, the fix ends a drag a sandboxed frame never saw released: verified.
    • Description, in Chromium such a drag on a Slider thumb or a pan never ends, and the frame never receives the pointerup: verified (full-Chromium probe; red-first tests).
    • Description, a top-level page already receives the pointerup and ends the drag: verified (the probe's top page receives it; onPointerUp ends the contact at GestureHost.ts:3961-4002).
    • Description, the thumb then follows the pointer back with no button down: verified (recording: 99 to 41 on main, 99 kept here).
    • Description, the Slider keeps its value tooltip forced open, so Escape cannot close it: verified (Slider.tsx:1653-1654 forces it open during a drag; on main the tooltip stayed open after Escape).
    • Description, the host tracks a mouse press through the window's pointer events only: verified (GestureHost.ts:2161-2164; on main only pointerup, pointercancel and blur end a mouse contact).
    • Description, the release goes to the top page alone, and pointer capture does not route it to the frame: verified (probe with and without pointer capture; the frame gets only a lost-capture event on return).
    • Description, the next event shows a move with the primary button up or a new press: verified (probe: the moves back report no buttons).
    • Description, the host ends the contact there as a lift at its last place, at that event's time, with no click guarded or replayed: verified (GestureHost.ts:3950-3957).
    • Description, the gesture spec already ends every press a lost focus or a cancel interrupts, and no record changes: verified.
    • Description, one private method called from onPointerMove and onPointerDown, mouse only, a chord keeps the press, touch and pen unchanged: verified (GestureHost.ts:3938-3944; GestureHost.test.ts:2876).
    • Description, the thumb goes from 90 to 64 before and stays at 90 after: verified at this head.
    • Description, a normal mouse drag still ends at its pointerup: verified (257 of 257 GestureHost tests pass).
    • Description, the full-build browser test fails on main and passes here, and the headless shell cannot show the bug: verified (Expected 90, Received 64 on main; the probe's headless shell delivers the release).
    • Description, no new public API, default or interaction model, and no internal context in public text: verified (built API surface unchanged; public text scanned).
    • Description, 2,079 unit tests over six folders and 1,089 over gestures and Slider pass: verified.
    • Description, 117 Slider and gesture interaction tests pass in Chromium: verified (117 passed, 5 skipped).
  • Files:
    • .changeset/gesture-missed-mouse-lift.md: clear.
    • packages/core/src/Slider/__tests__/SliderFramedRelease.interaction.browser.spec.ts: clear.
    • packages/core/src/gestures/GestureHost.ts: clear.
    • packages/core/src/gestures/__tests__/GestureHost.test.ts: clear.

Automated review (maintainer link)

josephfarina added a commit that referenced this pull request Nov 19, 2026
- #12252 docs(cli): agent docs name the prop names that differ from other libraries
  Author: Joey Farina <[email protected]>
- #12154 fix(core): a numeric typography weight builds through an extended base's adaptation rules
  Author: Joey <[email protected]>
- #12092 fix(cli): theme build reads the Core it builds with for variant declarations, and names the build command alone
  Author: Joey Farina <[email protected]>
- #12316 fix(core): a shorthand never follows its own longhand in one style merge
  Author: josephfarina <[email protected]>
- #12357 fix(core): a Table stays the scroll region when a host scrolls every table's parent
  Author: Joey Farina <[email protected]>
- #12349 fix(core): end a mouse drag a sandboxed frame never saw released
  Author: josephfarina <[email protected]>
- #12425 fix(cli): use a stored doc parse only with the zod release that made it
  Author: Joey <[email protected]>
- #12396 fix(AppShell): with the standard width points, a server-rendered shell hides its inline side nav on a phone before its script runs
  Author: Joey <[email protected]>
- #12438 fix(charts): end dots draw whole and a thinned axis keeps its last label
  Author: Joey Farina <[email protected]>
- #12448 fix(cli): upgrade outside a project names the project, not --from
  Author: Joey Farina <[email protected]>
- #12459 fix(templates): the dashboard scorecard fits a phone screen
  Author: Joey Farina <[email protected]>
- #12428 fix(core): Field labels draw in a bolder face than their description
  Author: Joey Farina <[email protected]>
- #12435 fix(theme-matcha): dark menus, popovers and muted fills take the theme's deep gray neutral
  Author: Joey <[email protected]>
- #12432 fix(templates): dashboard chart labels show whole instead of clipped by the chart edge
  Author: Joey Farina <[email protected]>
- #12441 fix(cli): mark icon-set generated calls pure so apps drop unused icons
  Author: Joey Farina <[email protected]>
- #12472 fix(MetadataListItem): a value breaks only a word longer than its line
  Author: Joey <[email protected]>
@josephfarina

Copy link
Copy Markdown
Contributor Author

Landed in #12718.

@github-actions
github-actions Bot deleted the rl-19-gesture-missed-up branch November 19, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — b8330f32 Deployed Nov 17, 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