Skip to content

feat(ContextMenu): where a coarse pointer's held finger opens the menu (presentation unset, or adaptive where it stays a popover), the same finger slides onto an item and its lift selects it - #8133

Draft
vjeux wants to merge 206 commits into
meta:mainfrom
vjeux:uikit/c20-contextmenu-scrub

Conversation

@vjeux

@vjeux vjeux commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Stack: #11837 → #8125 → #9816 → #8133 → #8201
Merge group: #8125, #9816, #8133

User need

A long press opens the ContextMenu under the finger, but that finger can't pick: the user lifts and presses again. DropdownMenu and iOS context menus let it slide onto an item and lift.

Problem and solution fit

  • When the menu opens under a finger still down (735 ms), the touch layer hands it to DropdownMenu's press model. pointerIdOf names its pointer, and continueGesture takes it as the opening press.
  • UIMenu's handoff applies (spec:AST-094 FR33). Past 10 px from the first position the open menu sees, the item under the finger lights and the lift selects it. A still lift selects nothing.
  • A menu opened at the lift hands nothing over; mouse, keyboard, popover presentation and fine pointers are unchanged.
  • A finger held through the touch layer's load hands over too: feat(ContextMenu): open from a held finger on iOS 26's timeline #8125 pairs its pointer as the layer mounts.

Current specification

module:DropdownMenu/useMenuPress FR11 asks for this continuation, and component:ContextMenu FR5 for the handoff. New FR13 states the slide. After the touch model's hold opens the menu at the finger, the same finger may slide onto an item without lifting. Lifting over an item selects it, and lifting over no item leaves the menu open. FR33's handoff follows.

Public delta and caller burden

useMenuPress's return gains a documented continueGesture, with an exported MenuPressContinuation type. First-load gzip over #9816: menu +115 B, table +142 B.

Design and alternatives

Rejected: ContextMenu tracking the finger, since the shared press model owns the highlight, pick and stray click. continueGesture is ported from #8507, which closes as absorbed.

Evidence

The real-device iPhone side-by-side against f913915 and the Android (DEC-27) emulator takes have not run at this head. At 936263c, on an iPhone 14 (iOS 26.2 Safari), it matched f913915 in all six cases. They are the hold, early lift, drift, slide onto an item, still lift and pan outside.

Scope

Components: ContextMenu, useMenuPress

  • One capability is added.
  • Unrelated fixes, cleanup, and policy changes were removed or split.
  • Consumer docs, focused tests, and migration evidence ship with the feature.
  • Public text and artifacts contain no internal Meta context.

Writing rubric results

Over component:ContextMenu: FR13 adds the slide, then FR33's handoff; FR5 points to it in place of its gap, at the same cell width. FR11 of module:DropdownMenu/useMenuPress names it, and its public contract and concepts table name continueGesture.

  • R3 evidence: FR13's basis is module:DropdownMenu/useMenuPress FR11 and spec:AST-094 FR33.
  • R1 narration, R2 research, R4 rejected alternatives, R5 change references, R6 open questions, R7 project status: none.

Testing

This round, at 8f14c7c, on main 64806d0:

Local checks at bd883b0, one worker:

  • the tests this change reaches on main 64806d0 (test:ui --changed, the boundary test included): 519 files, 15,472 passed;
  • the lazy-sheet and touch-loader boundary tests: 6 passed;
  • 6 interaction specs: ContextMenu's long press and DropdownMenu's touch press, hand-off, drag highlight, entrance hold and opening release. Chromium 65 passed, 1 skipped; WebKit under the CI profile 53 passed, 13 skipped;
  • 9 a11y specs in Chromium, 91 passed: ContextMenu's, Layer's press and touch trigger, the typeahead and the menu press. The cursor-anchor and Layer context-menu specs in WebKit, 7 passed;
  • the Storybook build, the core typecheck, strict eslint and prettier on the changed files, changeset coverage, check:changesets, check:knowledge, check:component-import-boundaries, and pnpm review:pre (0 findings; merges clean).

Final local checks at 8aed263, one worker:

  • the tests this change reaches on main 64806d0 (test:ui --changed, the boundary test included), from a fresh results cache: 519 files, 15,475 passed. Runs that reused an earlier run's order timed out four tests at the cold start. They are main's semanticFence.shared and useToast.fallback.shared tests, and ContextMenu's two sheet-loading tests, from main's perf(ContextMenu): load the touch sheet's action list only for the sheet presentation #11616. On main in that order, the sheet-loading file took 27.5 s, near the 30 s limit;
  • ContextMenu's long-press interaction spec: Chromium 39 passed, 1 skipped; WebKit under the CI profile 30 passed, 10 skipped;
  • the Storybook build, the core typecheck, strict eslint and prettier on the changed files, changeset coverage and check:changesets. Also check:knowledge, check:component-import-boundaries, the shared-identity check (7 passed), and pnpm review:pre (0 findings; merges clean).

At 8f14c7c, which brings #8125's loader fix, the ContextMenu, Layer, DropdownMenu and useMenuPress units ran again: 1,420 passed. So did the core typecheck, strict eslint, prettier, check:knowledge, the shared-identity check and pnpm review:pre (0 findings; merges clean).

The previous round, at 9df32ef:

Local checks at 9df32ef, one worker:

  • the tests this change reaches on main 4800d99 (test:ui --changed, the boundary test included): 517 files, 15,432 passed;
  • lazy-sheet-bundle.test.mjs: 4 passed;
  • the long-press spec, every case three times: Chromium 117 passed, 3 skipped; WebKit under the CI profile 90 passed, 30 skipped;
  • DropdownMenu's interaction specs: Chromium 26 passed; WebKit 23 passed, 3 skipped;
  • the Table resize-edge spec in Chromium: 3 passed;
  • the core typecheck, strict eslint and prettier on the changed files, changeset coverage, check:changesets, check:knowledge, and pnpm review:pre (0 findings; merges clean).

The previous round, at acd9841:

Local checks at acd9841, one worker:

  • the tests this change reaches on main 4800d99 (test:ui --changed): 516 files, 15,408 passed;
  • the long-press spec, every case three times: Chromium 105 passed, 3 skipped; WebKit under the CI profile 81 passed, 27 skipped;
  • DropdownMenu's interaction specs: Chromium 26 passed; WebKit 23 passed, 3 skipped;
  • the Table resize-edge spec in Chromium: 3 passed;
  • the core typecheck, strict eslint and prettier on the changed files, check:changesets and check:knowledge.

The previous round, at 936263c:

Local checks at 936263c, one worker:

  • the tests this change reaches on main 36f68b0 (test:ui --changed): 500 files, 14,933 passed;
  • the long-press spec, every case three times: Chromium 102 passed, 3 skipped; WebKit under the CI profile 78 passed, 27 skipped;
  • DropdownMenu's interaction specs: Chromium 26 passed; WebKit 23 passed, 3 skipped;
  • the core typecheck, strict eslint and prettier on the changed files, changeset coverage, check:changesets and check:knowledge.

The previous round, at ace89cf:

Local checks at ace89cf, one worker:

  • the tests this change reaches on main 56680f6 (test:ui --changed): 499 files, 14,845 passed;
  • the long-press spec, every case three times: Chromium 102 passed, 3 skipped; WebKit under the CI profile 78 passed, 27 skipped;
  • DropdownMenu's interaction specs: Chromium 26 passed; WebKit 23 passed, 3 skipped;
  • the core typecheck, strict eslint and prettier on the changed files, changeset coverage, check:changesets and check:knowledge.

The previous round, at a4b9181:

Local checks at a4b9181, one worker:

  • check:knowledge, check:changesets, prettier on the changed files, and strict eslint on the specs; the useMenuPress units, 87 passed;
  • the long-press spec, every case three times: Chromium 102 passed, 3 skipped; WebKit under the CI profile 78 passed, 27 skipped.

The previous round, at e165a7b:

Local checks at e165a7b, one worker. The unit and DropdownMenu runs are at 460e05d, an earlier version of e165a7b that is not in this pull request. It differs only in the long-press spec:

  • the tests this change reaches on main 50beab9 (test:ui --changed): 499 files, 14,817 passed;
  • the long-press spec, every case three times: Chromium 102 passed, 3 skipped; WebKit under the CI profile 78 passed, 27 skipped;
  • DropdownMenu's interaction specs: Chromium 26 passed; WebKit 23 passed, 3 skipped;
  • the core typecheck, strict eslint and prettier on the changed files, changeset coverage, check:changesets and check:knowledge.

The previous round, at 469ef88:

Local checks at 469ef88, one worker (the browser runs at 0ab5763, which differs only in that deps list):

  • the tests this change reaches on main 4d1cb82 (test:ui --changed): 497 files, 14,576 passed;
  • the long-press spec, every case three times: Chromium 99 passed, 3 skipped; WebKit under the CI profile 78 passed, 24 skipped;
  • DropdownMenu's interaction specs: Chromium 26 passed; WebKit 23 passed, 3 skipped;
  • the core typecheck, strict eslint and prettier on the changed files, changeset coverage, check:changesets and check:knowledge.

The previous round, at 01f789a:

Local checks at 01f789a, one worker (the unit and DropdownMenu runs at 8ee6c8d, whose product code is the same):

  • the tests this change reaches on main 1740654 (test:ui --changed): 488 files, 14,426 passed;
  • the long-press spec, every case three times: Chromium 99 passed, 3 skipped; WebKit under the CI profile 78 passed, 24 skipped;
  • DropdownMenu's interaction specs: Chromium 26 passed; WebKit 23 passed, 3 skipped;
  • the core typecheck, strict eslint and prettier on the changed files, changeset coverage, check:changesets and check:knowledge.

Android (DEC-27), earlier, at 292bbe9: normal, 4× CPU, no animations, 2 takes each. Slide onto an item and lift picks it 6/6. Hold and lift picks nothing, and the menu stays open 6/6. Slide off and lift picks nothing 6/6. Reduced motion verified in-page. Earlier, on the iOS 26.2 Simulator at efe3f12: hold, menu, tap outside and early lift.

The previous round, at 7295d1b: it merges #9816's head 8fc523e. That head merges #8125's main merge 330fcc9 and times a pen's growth from its landing, as a finger's. It merges with no conflict. This pull request's own diff over #9816 is unchanged (same patch-id and files).

Local checks at 7295d1b, one worker:

  • the tests this change reaches on main 6ab0c2e (test:ui --changed): 489 files, 14,436 passed;
  • the long-press spec, every case three times: Chromium 96 passed, 3 skipped; WebKit under the CI profile 75 passed, 24 skipped;
  • DropdownMenu's interaction specs: Chromium 26 passed; WebKit 23 passed, 3 skipped;
  • the core typecheck, strict eslint and prettier on the changed files, changeset coverage, check:changesets and check:knowledge.

The previous round, at f7d5dd0:

  • f7ff7ea: continueGesture and MenuPressContinuation lose their @internal tag. @astryxdesign/core/hooks exports the type. The hook's docs list the member with its usage, and a [feat] changeset names both. No behavior changes.
  • f7d5dd0, records only: module:DropdownMenu/useMenuPress names the member in its public contract. Its concepts table says what it does and when ContextMenu calls it.

API report, core built at 4b1f2a7 and at f7d5dd0: UseMenuPressReturn.continueGesture loses @internal, and MenuPressContinuation (pointerId, pointerType, time) joins the exports.

Local checks at f7d5dd0, one worker:

  • the tests this round reaches (test:ui --changed over 4b1f2a7): 232 files, 6,702 passed;
  • the core typecheck, eslint, check:changesets, changeset coverage and check:knowledge.

The previous round, at 4b1f2a7: it merges #9816's head 8fb305f, with its iframe-clock fix and its comment and record changes from review. The touch layer's header keeps both sides' sentences. This pull request's own diff over #9816 is otherwise unchanged (same patch-id and files).

Local checks at 4b1f2a7, one worker:

  • the tests this change reaches on main b8835b8 (test:ui --changed): 486 files, 14,298 passed;
  • the long-press spec, every case three times: Chromium 96 passed, 3 skipped; WebKit under the CI profile 75 passed, 24 skipped. That WebKit run was a full rerun after the first run's container was killed from outside, with no failure;
  • DropdownMenu's interaction specs: Chromium 26 passed; WebKit under the CI profile 23 passed, 3 skipped;
  • the keyboard-capped lists spec: Chromium 7 passed; WebKit 7 passed;
  • the gesture specs: Chromium 77 passed, 4 skipped; WebKit 69 passed, 12 skipped; presented hit testing 6 passed in each;
  • in Chromium: the ContextMenu audit (18 passed), long-press a11y (3 passed), cursor-anchor (3 passed) and menu hover-focus (7 passed) specs;
  • in WebKit: the cursor-anchor spec (3 passed);
  • the core typecheck, strict eslint and prettier on the changed files, changeset coverage, check:changesets and check:knowledge.

The previous round, at 3f21ccf:

Local checks at 3f21ccf, one worker:

  • the tests this change reaches on main b8835b8 (test:ui --changed): 486 files, 14,297 passed;
  • the long-press spec, every case three times: Chromium 96 passed, 3 skipped; WebKit under the CI profile 75 passed, 24 skipped;
  • DropdownMenu's interaction specs: Chromium 26 passed; WebKit under the CI profile 23 passed, 3 skipped;
  • the keyboard-capped lists spec: Chromium 7 passed; WebKit 7 passed;
  • the gesture specs: Chromium 77 passed, 4 skipped; WebKit 69 passed, 12 skipped; presented hit testing 6 passed in each;
  • in Chromium: the ContextMenu audit (18 passed), long-press a11y (3 passed), cursor-anchor (3 passed) and menu hover-focus (7 passed) specs;
  • in WebKit: the cursor-anchor spec (3 passed);
  • the core typecheck, strict eslint and prettier on the changed files, changeset coverage, check:changesets and check:knowledge.

The previous head, 17cab2a, sat on b80098f, which merges #9816's head 0b1f31c with no conflict. That brings #8125's final head cae3644. There a menu timer that runs more than a frame late waits up to 50 ms for moves queued behind the block. The press reads the page's time from the arena's injected clock.

17cab2a makes the stays-put anchor case read the menu as laid out, not as painted. The menu's entrance plays as a transform on its layer. WebKit's software GL compiles that layer's shaders on its first draw. On a cold cache, the case's first read caught the entrance's first frame, 4 px off. An anchor that moved the menu still moves its laid-out box. With a fresh shader cache, the old read failed 3 of 3 runs, and the new one passed 3 of 3.

Local checks at 17cab2a, one worker:

  • the long-press spec: Chromium 31 passed, 1 skipped; WebKit under the CI profile 25 passed, 7 skipped;
  • the keyboard-capped lists spec: Chromium 7 passed; WebKit 7 passed;
  • the gesture specs: Chromium 76 passed, 4 skipped; WebKit 68 passed, 12 skipped; presented hit testing 6 passed in each;
  • the ContextMenu audit (18 passed), long-press a11y (3 passed) and cursor-anchor specs in Chromium (3 passed), and the cursor-anchor spec in WebKit (3 passed);
  • the ContextMenu, Layer, motion, DropdownMenu, hooks, gestures, utils and lift units (5,385 passed), the core typecheck, eslint, check:changesets and check:knowledge.

The previous head, ac3dab7, merged #9816's 782cdbd. There the press judges each coalesced sample at its own time, and an on-time finger gets the menu at 735 ms.

The previous head, 967b5f6, merged #9816's e25ec8c with no conflict. It brought #9816's set-height fix for the inner visual box and its trigger attribute test.

The previous head, ec0cc34, merged #9816's 2ef1714; its checks ran at e687ed5, the same tree.

At earlier heads, below, "this head" means f62eada.

Android exit timing (contextmenu-default): main none/64 ms, head none/86 ms (6 interleaved rounds; main max gap 92 ms)

Replayed onto main cd748d0 after #9814's squash: 983e46f is one commit with this pull request's own diff at bc4efd0. Its message lists the folded commits. Then 8130a0b, 08a3ad5 and ad37823 merge #9816's heads 8da39a8, 343df06 and c9d07a9. 0ac4cb7 records ContextMenuLongPress's WebKit time (below), and this head, f62eada, merges #9816's cc254d7 (#8125's two record sentences; check:knowledge rc 0). It adds and removes the same lines in the same 10 files (612 added, 75 removed). The patch-id moved only because the onOpen(…, held) lines now sit beside two new touch-layer props and inside a flushSync. Its ContextMenu files equal e2f6057's plus #8125's second-document test, 735 ms proof, PR1 sentences and one lint-directive comment line. So the menu behaves the same. The tree also carries main 92784f6, which #8125 merges. Local checks at ad37823: ContextMenuLongPress in Chromium (24 passed, 1 skipped) and in WebKit under the CI profile (20 passed, 5 skipped). At 08a3ad5, which differs only in #8125's 735 ms proof: core typecheck; the ContextMenu, Layer and DropdownMenu units (1,143 passed); CI=true pnpm lint (0 errors); check:knowledge. There the ui suite passed 22,774. DropdownMenuLazySheet's keyboard-open case failed once under load, and it passes alone on main and here. The node suite (test:node) passed 17,446, with one failure (below). Earlier versions of this description said CI=true pnpm lint, but those runs were pnpm lint, which reports @eslint-react/dom-no-flush-sync only as a warning; that claim is corrected here.

WebKit leg budget: playwright-legs.test.mjs prices a release-wide WebKit run at no more than four 510 s legs (2,040 s). ContextMenuLongPress.interaction.browser.spec.ts had no recorded WebKit time, so the planner priced it at 1.64 s a test. Three CI-profile WebKit runs of ad37823 (one worker, 4 CPUs, the CI image) were timed as the planner's recordLog times a CI log. They took 58.2, 58.3 and 58.7 s for its 25 tests: 2.33 s a test. This pull request's CI has not run WebKit at a head with this spec, so no CI log has the number. This head records the median, 58.3 s, in .github/playwright-leg-durations.json. The release-wide estimate is then 2,054 s (2,045 s with the prior), so the case still fails here; main, #8125 and #9816 pass it. CI & Release's #10631 adds a sixth WebKit leg, and no proof is cut.

Earlier, restacked by merge on main 6cbcbf8 (#10260) over #9816's head 63c7a6c. This pull request's own diff was unchanged (same patch-id and files as at 9e92240). Local checks at bc4efd0: core typecheck (0 errors); the touch-support bundle test (11 passed); the ContextMenu, Layer, hooks, utils and gestures units (3,696 passed).

Earlier, restacked on main 4598223, which has #10275's guarded presentation read, over #9816's head 27de157. The slide changeset names its scope. The primary pointer is coarse, and the menu opens at the finger (presentation unset, or adaptive where it stays a popover). A presentation="popover" or fine-pointer long press hands nothing over. useMenuPress's header keeps main's @output sentence and adds one. Local checks at the stack's top on the same base:

  • core typecheck;
  • the Layer, ContextMenu, Indicator, utils, motion, gestures, DropdownMenu and hooks units (4,997 passed);
  • ContextMenuLongPress in Chromium (22 passed, 1 skipped) and in WebKit under the CI profile (19 passed, 4 skipped);
  • the three ContextMenu a11y specs (27 passed).

Android is retaken at the landing head.

Earlier, restacked for the chain landing on #9816's head (main 79cc4ac): FR5 points the slide to FR13. Local checks at ebe2c47: core typecheck; the Layer, ContextMenu, Indicator, utils, motion, gestures and DropdownMenu units (3,932 passed); eslint on the changed files; check:knowledge; check:changesets.

On #9816 at 4efcbc4, over #8125 c4f8964 and the merge worker's #9814 head (main 3731ec3). This pull request carries only its own five commits, the same ones that passed the stack's gates on main 9e559e9 (6b4f1dc). Two lines met #9816's: the touch story's wording keeps the coarse-pointer condition, and FR5's row points to FR13 on main's text. FR12 keeps #9816's springs.

The stack at fec928b differs in what #9816 and #8125 name:

This pull request's slide onto an item is unchanged.

Local checks at efe3f12. Later commits change changesets, docs, comments, the story text, test titles and FR13's scope (a long press that opens the menu at the finger). They also bring #9816's never-read field and its anchor fix (only the trigger's own growth is cancelled). At this head, f913915: core typecheck and the ContextMenu units (171 passed). On its code before a one-helper move (8bb478c):

  • CI=true pnpm lint (0 errors), check:knowledge and check:changesets;
  • the ContextMenu, Layer, DropdownMenu, hooks and utils units (3,010 passed);
  • the ContextMenu interaction specs in Chromium (22 passed, 1 skipped) and WebKit (19 passed, 4 skipped);
  • the ContextMenu a11y specs in Chromium (24 passed).

At efe3f12:

  • CI=true pnpm lint (0 errors), core typecheck, check:knowledge and check:changesets;
  • the ContextMenu, Layer, DropdownMenu, motion, hooks, gestures and utils units (4,701 passed);
  • the Chromium interaction specs for ContextMenu, Layer and DropdownMenu (44 passed, 1 skipped);
  • WebKit's ContextMenuLongPress, inputHold and DropdownMenuDragHighlight (34 passed, 8 skipped).
  • Real fingers: the finger the menu opened under slides onto Share, which lights under it, and its lift selects it. A 6 px lift selects nothing and leaves the menu open.
  • Red first: the slide-to-select unit case on the iOS and the Android stub, and seven continuation cases in useMenuPress.test.tsx, each fail before the change.
  • Desktop: no mouse, keyboard or presentation="popover" path changes.

App-level size measured then, at 4b1f2a7 and for the set from main b8835b8, predates the deferred touch layer. Those figures no longer hold, and this round's first-load figures replace them.

Public and internal API delta

Public, documented: useMenuPress's return gains continueGesture(pointer), and the hooks entry exports its MenuPressContinuation type (module:DropdownMenu/useMenuPress FR11). Its record, docs and a changeset name both. Usage: menuPress.continueGesture({pointerId, pointerType, time: Date.now()}).
Why: the menu that opens under a held finger takes that finger as its opening press. So the slide picks through the shared press model's highlight, pick and stray-click handling. Existing ones considered: ContextMenu tracking the finger itself, a second press path (Design). And a separate internal hook beside useMenuPress, which main's #8078 removed for one press path.

Lines, over #9816's head:

  • product +128/−34 (useMenuPress.ts +63/−8, ContextMenuTouchLayer.tsx +42/−12, ContextMenu.tsx +18/−13, hooks/index.ts +5/−1);
  • tests +533/−3, records +10/−8, docs +11/−3, story +42/−20, changesets +14/−0, CI leg data +1/−0.

@vercel

vercel Bot commented Oct 24, 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 15, 2026 4:46pm UTC

Request Review

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

astracat-bot Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟡 Reviewed (for maintainers only) Nov 15, 2026, 5:20 PM 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.

This pull request is on hold for an engineering owner's decision: sliding the finger that opened a ContextMenu onto an action is a clear win on touch, but a lift before the finger has moved 10 px acts on nothing even over a row, which departs from the current useMenuPress FR1 ("A row MUST act when a press is released over it"), and no spec record states that handoff yet. An engineering owner can settle it by amending the useMenuPress record with the handoff exception (or asking for FR1 behavior), approving or rejecting the new draft requirements (AST-094, the touchOpen press mode in FR9 and DEC-8), and recording the decision by commenting /approve-spec 30320a7995ce2444f8b9a8a3abfee712ce6c1655 on this pull request; the author may do so as an engineering owner. Independently of that decision, please narrow this pull request to the ContextMenu change once its dependencies land (it currently carries about 27,000 authored lines) and fix these:

  • useMenuPress.spec.md still lists a 500 ms long-press delay while useMenuPress.ts now uses 150 ms.
  • The isOpen Effect in ContextMenu.tsx sets state after the menu closes; do that work in the close handler instead.
  • MenuPressContinuation documents x and y, which continueGesture never reads.

[Automated review]

Comment thread packages/core/src/hooks/useMenuPress.ts Resolved
Comment thread packages/core/src/hooks/useMenuPress.ts Resolved
@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Current run: The current CI run concluded skipped. 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.

This pull request is on hold for an engineering owner's decision: letting the finger that opened a ContextMenu slide onto an action is a clear improvement on iPhone and iPad, but a lift before that finger has moved 10 px acts on nothing even over a row, which departs from the current useMenuPress FR1 ("A row MUST act when a press is released over it"), and the branch also adds draft requirements no owner has approved yet (AST-094, the rewritten useMenuPress FR9 and DEC-8, and DropdownMenu FR8). An engineering owner can settle it by amending the useMenuPress record with the handoff exception (or asking for FR1 behavior), approving or rejecting those draft requirements, and recording the decision by commenting /approve-spec 8507258b8d930890afc2e5c68bc86d6ca7bbe152 on this pull request; the author may do so as an engineering owner. Independently of that decision, please narrow this pull request to the ContextMenu change once its dependencies land (it currently carries about 28,000 authored lines) and fix these:

  • useMenuPress.spec.md still lists a 500 ms long-press delay while useMenuPress.ts now uses 150 ms.
  • The isOpen Effect in ContextMenu.tsx sets state after the menu closes; do that work in the close handler, or name the external system it synchronizes.
  • MenuPressContinuation documents x and y, which continueGesture never reads.

[Automated review]

@vjeux
vjeux force-pushed the uikit/c20-contextmenu-scrub branch from 8507258 to 53ad03a Compare October 25, 2026 01:37
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Oct 25, 2026
@vjeux

vjeux commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

Addressed in 53ad03a:

@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 is on hold for an engineering owner's decision: letting the finger that opened a ContextMenu slide onto an action is a clear improvement on touch screens, but a lift before that finger has moved 10 px acts on nothing even over a row, which departs from the current useMenuPress FR1 ("A row MUST act when a press is released over it"), and the branch also adds draft requirements no owner has approved yet (AST-094, the rewritten useMenuPress FR9 and DEC-8, and DropdownMenu FR8). An engineering owner can settle it by amending the useMenuPress record with the handoff exception (or asking for FR1 behavior), approving or rejecting those draft requirements, and recording the decision by commenting /approve-spec 53ad03a281b02154cf8d36087e0436518cc2dfb8 on this pull request; the author may do so as an engineering owner. Independently of that decision, please narrow this pull request to the ContextMenu change once its dependencies land (it carries about 34,000 authored lines today) and fix these:

  • ContextMenu's import grows by about 28 KB gzip of touch-only code; load it lazily for coarse pointers or justify the cost, as component-style-authoring INV6 requires.
  • The new platform theme-adaptation condition is outside the closed vocabulary of AST-012 FR2; drop it or have FR2 amended first.
  • CI's pressableCoverage.test.ts fails because ContextMenu.tsx calls usePressFeedback() without a press arm the guard recognises.
  • useMenuPress.spec.md still lists a 500 ms delay and the settle rule for the opening finger; #8078's current head already fixes both.
  • The slide-to-pick changeset says Android keeps today's menu, and the touch-presentation changeset says a theme's md is followed; neither matches the code.
  • MenuPressContinuation documents x and y, which continueGesture never reads.

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

This pull request is on hold for an engineering owner's decision: letting the finger that opened a ContextMenu slide onto an action is a clear improvement on touch screens, but a lift before that finger has moved 10 px acts on nothing even over a row, which departs from the current useMenuPress FR1 ("A row MUST act when a press is released over it"), and the branch also adds draft requirements no owner has approved yet (AST-094, the rewritten useMenuPress FR9 and DEC-8, and DropdownMenu FR8). An engineering owner can settle it by amending the useMenuPress record with the handoff exception (or asking for FR1 behavior), approving or rejecting those draft requirements, and recording the decision by commenting /approve-spec 86076e91586049ffb2f1c493270f5b0998440577 on this pull request; the author may do so as an engineering owner. Independently of that decision, please narrow this pull request to the ContextMenu change once its dependencies land (it carries about 38,500 authored lines today) and fix these:

  • An explicit presentation="popover" no longer opens the menu from a held finger, so on iPhone and iPad that ContextMenu cannot be opened by touch at all; keep the previous long press there, as AST-017 FR3 requires of the restoring value.
  • ContextMenu's import grows by about 31 KB gzip of touch-only code, including spring rows it never reads; load it lazily for coarse pointers or justify the cost, as component-style-authoring INV6 requires.
  • useMenuPress.spec.md still lists a 500 ms delay and the settle rule for the opening finger, while the code uses 150 ms and the 10 px handoff.
  • The slide-to-pick changeset says Android keeps today's menu, and the touch-presentation changeset says a theme's md is followed; neither matches the code.
  • MenuPressContinuation documents x and y, which continueGesture never reads.
  • The new @astryxdesign/core/motion/reducedMotion.stylex subpath is stable and cites an AST-094 open question that does not exist; drop it or keep it experimental.

[Automated review]

Comment thread scripts/sync-exports.js Resolved
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 25, 2026
@vjeux
vjeux force-pushed the uikit/c20-contextmenu-scrub branch from 86076e9 to a885d27 Compare October 25, 2026 09:07
vjeux added 24 commits November 15, 2026 02:14
Main's meta#11735 re-aligned spec:AST-094's verification table and widened
its FR5 row. The one conflict is that table. The merge takes main's
table and re-applies this pull request's two additions to the
FR15-FR17 row: the late-deadline cases and the failure they catch.
Brings the arena fix's ec2e905: main 64806d0, FR16's third
sentence in the first sentence's gate, and two dropped comments. The
one conflict is spec:AST-094's verification table, which main's
meta#11735 re-aligned. The merge takes main's table and re-adds this pull
request's FR43 late-begin row.
spec:AST-094's FR16 gap note said a late deadline waits 50 ms or more.
Since the arena fix, that holds only while the latest contact is a
finger or a pen, as FR16 says. ContextMenu's touch hold is a finger's
or a pen's, so its menu can still show that much later.
Brings meta#8125's merge of the arena fix's main merge (main 64806d0)
and its FR16 gap note. No conflicts.
Brings, through meta#9816, main 64806d0 and meta#8125's FR16 gap note. No
conflicts.
The proof turned touch on only after the page loaded, then pressed at
once and gave the menu 2 s. The touch layer loads after the first
paint, when the page is idle, within 2 s. A finger that lands sooner
starts its hold only when the layer mounts. On a busy machine the menu
then opened after 2 s, and the proof failed.

Touch is now on from the first paint. In the touch-model case the
proof waits for the layer's chunk, its module and two frames, as the
interaction proof does, then presses. The popover story keeps today's
long press and loads no layer, so it does not wait. With the chunk
held 2.5 s, the old proof fails and the new one passes.
Brings meta#8125's test fix: the lift's click proof turns touch on from
the first paint and waits for the touch layer. No conflicts.
Brings, through meta#9816, meta#8125's test fix to the lift's click proof. No
conflicts.
After a failed load, only a touch on a trigger should ask again. A
trigger that mounts is no intent, so it must start no load. This case
fails here: the failure path clears the windows that scheduled the
load, so the next trigger to mount schedules a new one.
The failure path cleared the windows that had scheduled the load, so
the next trigger to mount started a new load with no intent. The
windows now keep their mark, and only a touch on a trigger asks again,
as the touch layer's load rule says.
The comment said a finger's pointerdown follows its touchstart "as in
WebKit", with no record or probe behind it. It now names only the
order it handles.
The shared-identity check flags four module-scope bindings in the
touch loader: its state, the windows that scheduled the load, the load
in flight and the listeners. Each copy of Core loads and renders its
own touch layer, whose component reads that copy's contexts, so the
state stays per copy. The baseline allows the four with that reason.
Brings meta#8125's fixes from review: after a failed load only a touch
asks again, the pointer-order comment, and the touch loader's
per-copy state in the shared-identity baseline. No conflicts.
From review: one sentence of the press feedback's growth comment ran
26 words. It is now two: the press machine never ends the growth; the
recognizer ends it, and the menu holds and returns it.
Brings meta#9816's growth comment from review and, through it, meta#8125's
review fixes. No conflicts.
From review: the trigger pairs a late finger with its pointer in both
orders, but only pointerdown-then-touchstart had a case. This one
sends the touchstart first, holds the finger through the load, and
slides it onto Share. With meta#8125's branch for that order removed, it
fails on both platforms, since Share never takes the focus; the
pointerdown-first case still passes. With the branch, both pass.
The public hook stripped prepare() and releasePrepared() from its
return with a memo and a rest copy, on every page that uses a layer.
Only ContextMenu calls them, through useLayerInternal. The public
type already hides them, so the hook now returns the object as is.
A page with DropdownMenu but no ContextMenu drops 25 B gzip.
Brings meta#8125's change that hides prepare() from the public useLayer by
type only, sparing every page with a layer the runtime strip. No
conflicts.
Brings, through meta#9816, meta#8125's useLayer slimming. No conflicts.
From review: after a failed load, a trigger whose window never
scheduled the load, such as one in a same-origin frame, still starts
one when it mounts. Only a touch should ask again, in every window.
This case mounts such a trigger after the failure; it fails here.
After a page-wide failure, a trigger whose window had not scheduled
the load still scheduled one as it mounted, with no intent. The load
now waits for a touch in every window: scheduleLoad does nothing once
the latest load has failed.
From review: since add87da the public useLayer returns the
implementation's object, so it carries prepare() and releasePrepared()
at runtime. Only its return type leaves them out. The layer-runtime
record now says so.
Brings meta#8125's fixes from review: after a failed load no window
schedules another, and the layer-runtime record says prepare() is
hidden from useLayer's type only. No conflicts.
Brings, through meta#9816, meta#8125's loader fix and record sentence. No
conflicts.
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 8f14c7c

@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. An engineering owner approved this head's record text and every earlier code finding is fixed; what remains is device evidence at this head:

  • The Android emulator takes the touch-presentation record requires at the exact head (Chrome with Gboard at normal animation scale, with animations removed, and on a slow-device profile) are not stated, so run them at the landing head and state each result in the description.
  • The real-iPhone side-by-side against the head the owner passed does not carry here, because this branch changed ContextMenu, its touch layer, loader and press, and the gesture arena and host since the last take, so run the six cases again and state the result.

A new head needs a fresh /approve-spec <full head SHA> from an engineering owner (the author may, as one). Non-blocking: name Layer and the gesture arena in the Scope line, since the outside-press watch gains a press listener and the arena's wait now reaches every touch recognizer.

Claims and files checked

Review mode: same-head; reason: none

  • Changeset, outside-press watch: a mouse or pen press closes the menu at its press in the menu's own document, and a press in the page no longer closes a menu in another frame: verified (Layer/outsidePress.ts:226-245; the ContextMenu case for the menu's own document).
  • Changeset, slide to pick: after the hold opens the menu, the same finger picks the action it lifts over once it has moved 10 px, a still lift picks nothing, and a lift over no action leaves the menu open: verified (ContextMenu slide cases; useMenuPress continuation suite).
  • Changeset, touch timeline: growth from 150 ms toward the held size on the lift spring, commit at 400 ms, menu at 735 ms or at a lift after 400 ms, 11.5 px drift, early-lift return, pan-outside close, no row lit on a touch open, the 500 ms long press under a fine pointer and with presentation="popover", and the touch code loaded after first paint: verified against the constants and unit cases; device behavior not verified at this head.
  • Changeset, gesture arena: a late finger or pen deadline waits 50 ms for queued input, a mouse keeps the one-task yield, and a deadline among coalesced samples runs between them: verified (arena unit cases); the List and Pager outcomes rest on the same shared arena.
  • Changeset, menu press continuation: useMenuPress returns continueGesture, and the hooks entry exports MenuPressContinuation: verified (hooks/useMenuPress.ts:1074-1096, hooks/index.ts, built API surface).
  • Description: the menu that opens under a held finger takes it as its opening press, and a menu opened at the lift hands nothing over: verified (ContextMenuTouchLayer.tsx:91-101, ContextMenu.tsx:874-885).
  • Description: a finger held through the touch layer's load hands over too: verified (the held-through-load slide case).
  • Description: mouse, keyboard, popover presentation and fine pointers are unchanged: verified (touch and coarse-pointer gating in the code).
  • Description: line counts over the growth pull request's head: verified (numstat).
  • Description: first-load gzip on the four reference pages: stated, not re-measured.
  • Description: the iPhone side-by-side and Android takes have not run at this head: verified, so neither is evidence yet.
  • Description: the unit, typecheck and merge claims: the units this change reaches pass (79 files, 2,230 tests), the core typecheck passes, and the head merges with main without conflict; browser specs not re-run.
  • Files read by their whole diff: ContextMenu, its touch layer, loader, press recognizer and press feedback, the context-menu constants, the private trigger attribute, the menu press hook with its docs and export, Layer's show path and outside-press watch, the gesture arena, host and types, the motion README, the five changesets, the four records, the component docs, the story and the two data files: findings as above, the rest clear.
  • Test files: all unit files run; the slide, late-begin, failed-load and arena cases read; the browser specs and the rest of the test diff not read line by line.

Automated review (maintainer link)

Comment on lines +85 to +88
* The latest event's positions at the times they came with, oldest first,
* ending with the current one. The arena's clock never runs back, so it
* holds a late input's `time` and filters `samples`; it does not change
* these.

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 (architecture:knowledge-contracts INV29): "it holds a late input's time and filters samples; it does not change these" has no clear referent for "it" and "these". Suggested: "The latest event's positions at the times they came with, oldest first, ending with the current one. The arena may hold time back for a late input. These samples keep the times the input came with."

This branch was successfully deployed

1 active deployment
Preview — 8f14c7c6 Deployed Nov 15, 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. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants