Skip to content

fix(DropdownMenu): a cancelled touch clears the row a finger lit - #8508

Merged
cixzhang merged 10 commits into
meta:mainfrom
vjeux:uikit/c19-menu-cancel-clear
Nov 11, 2026
Merged

cixzhang merged 10 commits into
meta:mainfrom
vjeux:uikit/c19-menu-cancel-clear

Conversation

@vjeux

@vjeux vjeux commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Behavior module: useMenuPress

One commit, merged with main at d9d7b10, which carries #8078.

User impact

On any device, a finger can light a row in an open DropdownMenu and then lose its press. The page scrolls, a second finger lands, or the window loses focus. The row stays lit and reads as a pending pick. iOS clears it, and nothing runs.

What led to it: the UIKit comparison behind spec:AST-094 FR28. A reviewer asked to split this fix out of #8078.

Problem and solution fit

The press model ended a cancelled gesture without acting but kept its highlight. That is right for a mouse, whose highlight follows hover (spec:AST-017 FR59). A cancelled finger's lit row now clears on every device (spec:AST-094 FR43). It clears in DropdownMenu under any presentation and its sub-menus, MoreMenu, ContextMenu, Selector's list and the sheet's action list. The nav menus' roots take no focus, so their rows keep a cancelled finger's highlight. A window blur withdraws the finger's gesture: the row clears, nothing runs, and its listeners end at its lift. A tap on the trigger that the blur interrupts keeps its click, so the menu still opens.

Expected behavior and authority

spec:AST-094 FR28 (current) says a cancelled touch, a second finger or the window losing focus ends the gesture. Nothing acts, and the lit row clears. No record changes.

Smallest restoration

  • Clear for every pointer: a mouse would lose its hover highlight.
  • Clear inside each component: the press model is shared by every menu.
  • Clear in the press model, only for a finger or pen (chosen): one place, mouse untouched.

Evidence

  • Failure before the change: on main at d9d7b10, these tests fail 12 of 445 cases. A cancelled finger leaves its row lit, in the root, in a flyout and in the bottom sheet's action list.
  • Success after the change: all 445 pass. The row clears, under presentation="popover" too, and a mouse keeps it lit.
  • Real Chromium: a cancelled touch and a window blur each end the gesture with nothing run and nothing lit.
  • A blur during a trigger tap: the tap's click still opens the menu, in the press model and in DropdownMenu under presentation="popover".

Scope

Components: DropdownMenu, MoreMenu, ContextMenu, Selector.

  • 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

On the DropdownMenu "Default" story, with touch emulation:

  1. Open the menu, and press a row until it is lit. Keep the finger down and switch to another window: the row clears, and lifting runs nothing.
  2. Do the same with a mouse button held: the row stays highlighted, as before.
  3. With presentation="popover", press the trigger, switch windows, come back and lift: the menu opens.

On an iPhone at e5e1609, DropdownMenu, ContextMenu and Selector match main side by side. That run can't drive the fix's own paths: a second finger, an app switch mid-touch, and a scroll while a row is held. They rest on the red-first tests: 12 of 445 fail on main without the fix.

Automated: the cancel, second-finger and blur cases fail on main at d9d7b10 without this change and pass here. So do the menu-press accessibility cases in Chromium. A [fix] changeset records the change.

The merge with main d9d7b10 applies this PR's own patch onto main: 10 files, +624/−19. A plain merge would bring back #8078's withdrawn split. The tree has no hooks/menuTriggerPress.ts, hooks/menuScrollView.ts, useMenuSurfacePress or useDropdownMenuPress.

Local gates at e5e1609, on d9d7b10, pass. They are the ui project (24,429), the Node project (19,552), the core type check, strict ESLint and pnpm review:pre. The DropdownMenu, motion, Layer, nav, Popover, ContextMenu and Selector interaction specs pass in Chromium: 318 pass, 16 skip. In WebKit's CI container at one worker, 239 pass and 95 skip. Their accessibility specs pass in Chromium (393), and the browser ones in WebKit (19).

A first Node run at 40 workers timed out two tests this PR does not touch (text-json-parity, active-release), under box load. Both pass alone here and on main.

Review only this PR's change: vjeux/astryx@d9d7b10...e5e1609

Public and internal API delta

  • Size: +624/−19 lines (d9d7b10..e5e1609), tests included.
  • App-level size: +170 B gzip, eager, on a 12-component page with DropdownMenu, MoreMenu, Popover, Dialog, BottomSheet and Selector.
  • Public: none. Exports, props, types and defaults are unchanged, and menuPressStep keeps its released types.
  • Internal, changed: in hooks/menuPressGesture.ts, MenuPressState gains a 'withdrawn' phase, MenuPressInput a withdraw input, and MenuPressOutcome a clear flag and a withdraw outcome. IDLE_MENU_PRESS's type widens to match.
    • Why: a window blur withdraws a finger's press, so its lift acts on nothing and its lit row clears (spec:AST-094 FR28, FR44).
    • Usage: menuPressTransition(gesture, {type: 'withdraw'}).effect is {type: 'withdraw', clear: true} while a row is lit.

@vercel

vercel Bot commented Oct 26, 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 1:09pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

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

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · e5e1609

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
DropdownMenuSubMenu 72.8 kB (+211 B) · 9.7 kB CSS (0) — ✗ · ✓ · ✓
DropdownMenu 101.7 kB (+195 B) · 17.6 kB CSS (0) — ✗ · ✓ · ✓
DropdownMenuCheckboxItem 23.4 kB (0) · 6.6 kB CSS (0) — ✗ · ✓ · ✓
24 more components
Component Size LoC Visual · A11y · RTL
DropdownMenuDivider 5.3 kB (0) · 548 B CSS (0) — ✗ · ✓ · —
DropdownMenuGroup 6.4 kB (0) · 3.4 kB CSS (0) — ✗ · ✓ · —
DropdownMenuItem 22.6 kB (0) · 6.3 kB CSS (0) — ✗ · ✓ · —
DropdownMenuRadioGroup 6.6 kB (0) · 3.3 kB CSS (0) — ✗ · ✓ · —
DropdownMenuRadioItem 23.4 kB (0) · 6.6 kB CSS (0) — ✗ · ✓ · —
TabMenu 76.6 kB (+290 B) · 11.2 kB CSS (0) — — · — · —
PowerSearch 298.3 kB (+256 B) · 24.5 kB CSS (0) — — · — · —
TopNavHeading 79.9 kB (+236 B) · 11.3 kB CSS (0) — — · — · —
BreadcrumbItem 89.5 kB (+210 B) · 12.1 kB CSS (0) — — · — · —
Selector 105.0 kB (+208 B) · 17.5 kB CSS (0) — — · — · —
Pagination 115.2 kB (+203 B) · 17.8 kB CSS (0) — — · — · —
TopNavMenu 79.3 kB (+196 B) · 11.3 kB CSS (0) — — · — · —
MoreMenu 102.0 kB (+191 B) · 17.6 kB CSS (0) — — · — · —
SideNavHeading 80.3 kB (+191 B) · 11.3 kB CSS (0) — — · — · —
ContextMenu 112.8 kB (+189 B) · 17.5 kB CSS (0) — — · — · —
TableCell 114.0 kB (+184 B) · 18.0 kB CSS (0) — — · — · —
Markdown 193.1 kB (+183 B) · 20.8 kB CSS (0) — — · — · —
TableHeaderCell 113.6 kB (+183 B) · 17.7 kB CSS (0) — — · — · —
NavHeadingMenu 18.1 kB (+178 B) · 3.5 kB CSS (0) — — · — · —
Table 129.9 kB (+168 B) · 18.4 kB CSS (0) — — · — · —
ContextMenuItem 32.9 kB (0) · 6.3 kB CSS (0) — — · — · —
lab/Comments 358.4 kB (new) · 2.5 kB CSS (new) — — · — · —
lab/CommentThread 351.6 kB (new) · 2.4 kB CSS (new) — — · — · —
richtext/RichTextEditorToolbar 284.1 kB (new) · 454 B CSS (new) — — · — · —
Visual changes: 4 snapshots in 1 component

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

Component · story Before After Diff
DropdownMenu · Lab Checkbox Items (probe, dark) before frame after frame diff frame
DropdownMenu · Lab Checkbox Items (probe, light) before frame after frame diff frame
DropdownMenu · Lab Checkbox Items (neutral, dark) before frame after frame diff frame
DropdownMenu · Lab Checkbox Items (neutral, light) before frame after frame diff frame

Package size: measured; main has no measurement of the merge base to compare yet.

API changes: unknown (base surface unavailable): richtext, theme-butter, theme-chocolate, theme-gothic, theme-matcha, theme-neutral, theme-stone, theme-y2k

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


Generated by PR Enrichment workflow | View full report

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 26, 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.

The fix itself (clearing the row a finger lit when the browser cancels its press, in DropdownMenu and its flyouts) matches spec:AST-094 FR28, but this pull request can't be approved as submitted. Against main its diff is about 24,600 changed lines, because it carries the four open pull requests it is stacked on (#8076, #8298, #8446 and #8078). Please land those first and rebase so this pull request contains only its own commit. While you're there, a test showing that a second finger, and not only pointercancel, clears the lit row would cover the rest of FR28.

[Automated review]

@vjeux

vjeux commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

At 36fd673:

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

This pull request can't be approved as submitted. Its own fix (a cancelled finger clears the lit row in DropdownMenu and its flyouts) matches spec:AST-094 FR28 and its new tests, including the second-finger case, cover it, but against main the diff is still about 23,300 changed lines because it carries #8076, #8298, #8446 and #8078. Please land those in the stated order and rebase so this pull request contains only its own two commits. While you're there, a window-blur case and a cancel case in the real-Chromium menu test would cover the rest of FR28's verification.

[Automated review]

vjeux added a commit to vjeux/astryx that referenced this pull request Oct 26, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 26, 2026
meta#8508 is a new dependency: the flyout's recognizer reads the surface's touch model. The continuation moved out of meta#8078 to meta#8507, so the press model here keeps the recognizer, the edge autoscroll and the host wiring without it.
@vjeux

vjeux commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

At 6ce4c57: the real-Chromium menu test adds FR28's other two cases, a cancelled touch and the window losing focus, each while a finger has a row lit. In both, the gesture ends with nothing acting, the row no longer lit, and the menu still open. Both fail on #8078's head, where the row stays lit.

The blur case also showed a gap: the browser can keep the touch alive past the blur, and that touch's later lift ran the row through its click. A gesture the blur ended now swallows that click (module FR5), and a jsdom case pins it. Main's model has the same gap, and this closes it.

vjeux added a commit to vjeux/astryx that referenced this pull request Oct 26, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 26, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 26, 2026
meta#8078's module FR10 cases moved to the sub-menu pull request, so they leave this line too; the flyout's cancel case keeps this line's gesture-system finger.


meta#8508's real-Chromium FR28 cases wait for this line's open animation to settle, as its own touch cases do; the blur case waits for the gesture host's fix.
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 26, 2026
The dependencies in one commit, already merged here, so this pull request's own change reads as one compare against it.

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

This pull request can't be approved as submitted. Its own fix, clearing the row a finger lit in DropdownMenu and its flyouts when the browser takes the touch, matches spec:AST-094 FR28, and the new cancel, second-finger and blur cases cover it, but against main the diff is still about 22,800 changed lines because it carries #8076, #8298, #8446 and #8078: please land those in the stated order and rebase so only this pull request's commits remain. The new blur commit also needs two changes:

  • The listener armStrayClickAtRelease adds is removed only by that pointer's release, so when the page never sees a mouse press's release after a blur, the next mouse click anywhere is swallowed; dropping it at the next pointerdown would bound it.
  • The post-blur swallow also changes what a mouse does, so spec:AST-017 FR59 asks for a mouse case before and after, or the swallow can be kept to fingers.

[Automated review]

Comment thread packages/core/src/hooks/useMenuPress.ts Resolved
Comment thread packages/core/src/hooks/useMenuPress.ts Resolved
A menu shown as a bottom sheet still opens at the tap's click, so the
release note names the anchored menu, as the press does. The hook's doc
names a finger or a pen on every device, as the hook acts.
A raw page that scrolls with the document. Its Actions menu sits in a
fixed top bar, so it opens as a finger presses it, and a slide onto a
row runs that row once. Its More menu sits in the page, so a flick that
starts on it scrolls the page. The bar shows which row ran and how many
times.
Under a finger, on every device and every menu surface, a press that
the browser takes (pointercancel, a second finger, a scroll) now clears
the row the finger lit, as UIKit clears it when the list starts
scrolling. That holds under any presentation, in sub-menus and in the
bottom sheet's action list. When the window loses focus under a finger,
its gesture is withdrawn: it stays tracked to its release, which acts
on nothing and whose click is swallowed, and any new press ends it. A
mouse keeps its highlight and its click.

- menuPressGesture: the withdraw input and withdrawn phase, and the
  clear flag on a finger's cancel.
- useMenuPress: both clears follow the machine's clear flag, which only
  a finger or pen sets.
- MenuBottomSheetActionList: its list takes focus (tabIndex -1) when no
  row is lit, as DropdownMenu's own menu does, so a cleared row loses
  focus.
- Tests: the machine, hook, sub-menu and sheet-list cases, and the
  accessibility case in real Chromium. A [fix] changeset.

@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: every job was skipped on this draft head, so mark it ready for review and have a maintainer add the ci:run label so CI runs.

This review covers the stack #8078 → #8508, and a pull request lands only when it and every pull request below it are approved.

#8078: approved, no blocking findings.

#8508: approved, no blocking findings.

Whole stack: passes.

  • Miss: optional (#8078). menuPressValues.ts repeats DELAYS_CONTENT_TOUCHES_MS, which motion/uikit/scroll.ts already exports, and the comment above longPressApiRef in useMenuPress.ts still says the detector is created in that file.

[Automated review]

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

Changes requested. The fix itself, a cancelled finger or a window blur clearing the row a finger lit while the blurred finger's lift runs nothing and a mouse keeps its highlight and click, matches spec:AST-094 FR28 and FR44 and has passing cases for each path. The approved spec edit for this head does not change the blockers below, which all come from the Stack line no longer holding, so this pull request is reviewed on its own and its diff from main includes #8078.

  • Regression: the Stack line no longer holds, because no listed pull request's head contains every other listed head (#9769's head is in no other entry, and neither #8080 nor this pull request contains the other's head), so #8078's open-on-press work (menuTriggerPress.ts, menuScrollView.ts, the DropdownMenu record's FR8 edits, the sandbox page and two changesets) rides in this diff and has to come out.
  • Regression: the diff is 2,693 authored lines, of which this pull request's fix is 649, and no stack or behavior-module exemption applies while the Stack line does not hold.
  • Regression: the UseMenuPressOptions.longPressDelayMs default change (500 to unset, useMenuPress.ts:154-160) is a public API row outside this pull request's scope (DropdownMenu, MoreMenu, ContextMenu, Selector), so it needs naming in the scope with an owner decision or leaving to #8078.

To clear all three, put back a Stack line that holds in every listed body (for example Stack: #8078 → #8508), or land #8078 first and merge main so the diff is the fix alone.

Automated review (maintainer link)

Comment thread packages/core/src/hooks/useMenuPress.ts Resolved
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 8418e2a

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 11, 2026
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec e5e1609

@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 every job skipped on this draft from a fork. Mark the pull request ready for review, and a maintainer adds the ci:run label so CI runs.

A cancelled touch, a second finger or a window blur now clears the row a finger or pen lit, and a blurred finger's later lift runs nothing, as spec:AST-094 FR28 and FR44 require, while a mouse keeps its highlight and its click. The new cases fail on main and pass here, the real-Chromium touch-cancel and blur cases included, and with #8078 on main the diff is now the fix alone.

  • Non-blocking: the comment at menuPressGesture.ts:283-287 can keep only its reasons; suggested wording is inline.

Automated review (maintainer link)

Comment on lines +283 to +287
// The withdrawn finger lifts: nothing acts, and the click the browser
// reports for it is still this gesture's, so it is swallowed. Its
// listeners come off as the gesture ends. A tap on the trigger keeps
// its click, which opens the menu: the pointer model's open, or a
// scroll view's open at the lift.

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.

Non-blocking (INV29): this comment holds three topics, a passive "it is swallowed", and a sentence that restates the code ("Its listeners come off as the gesture ends"). Keeping only the reasons reads:

// The browser still sends a click for this lift. Swallow it.
// A tap on the trigger keeps its click, because that click opens the menu.

@cixzhang cixzhang added ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) labels Nov 11, 2026
@vjeux
vjeux marked this pull request as ready for review November 11, 2026 14:08
@cixzhang
cixzhang merged commit 5770e5b into meta:main Nov 11, 2026
134 checks passed
@vjeux
vjeux deleted the uikit/c19-menu-cancel-clear branch November 11, 2026 14:56

This branch was successfully deployed

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

ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) 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.

2 participants