Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
2bcc49a
feat(ContextMenu): open from a held finger on iOS 26's timeline
vjeux Nov 7, 2026
812d3a4
test(ContextMenu): the hold's menu commits in its deciding task (red)
vjeux Nov 7, 2026
0776b40
fix(ContextMenu): the hold commits its menu in the task that decides it
vjeux Nov 7, 2026
e8f5ca1
test(ContextMenu): the menu mounts, closed, at the hold's commit (red)
vjeux Nov 7, 2026
0fbd309
fix(ContextMenu): the hold mounts the menu at its commit, closed
vjeux Nov 7, 2026
32e75c7
test(ContextMenu): a mouse press closes the menu in its own document
vjeux Nov 7, 2026
ba77ca8
Merge commit 'c8b4cba38181263ffa8fcc897975b61154cb91b0' into HEAD
vjeux Nov 7, 2026
df6fd04
docs(ContextMenu): PR1 names the outside-press watch and the touch query
vjeux Nov 7, 2026
abb70e1
test(ContextMenu): a starved page fails the 735 ms proof by name
vjeux Nov 7, 2026
b8a9055
Merge commit '62c7802e873ed3d020192e8218e5e1bcd4f8fad2' into HEAD
vjeux Nov 7, 2026
e66ff1d
Merge commit '92784f658939912fae623dd497cd35e499e13878' into HEAD
vjeux Nov 8, 2026
24c03c1
test(ContextMenu): a starved page's late timer fails by name in WebKit
vjeux Nov 8, 2026
339bf7e
docs(ContextMenu): PR1 names each presentation's query subscriptions
vjeux Nov 8, 2026
3d78dae
docs(ContextMenu): the record names the touch open's focus gap
vjeux Nov 8, 2026
20dc83f
Merge branch 'main' into uikit/c20-contextmenu-press
cixzhang Nov 8, 2026
a9188e6
Merge main
vjeux Nov 10, 2026
a5a0e12
test(ContextMenu): a finger that lifts before 400 ms is a plain tap
vjeux Nov 10, 2026
a6253f3
test(ContextMenu): a late drift past 11.5 px, a known Chromium gap
vjeux Nov 10, 2026
3c39a05
test(ContextMenu): a late drift past 11.5 px cancels in every engine
vjeux Nov 10, 2026
a4e0404
fix(ContextMenu): the menu waits for the finger's late moves
vjeux Nov 10, 2026
3b76a8c
test(ContextMenu): a finger inside the tolerance at the menu's moment
vjeux Nov 10, 2026
88cc0d8
fix(ContextMenu): the press reads each move's own time from the arena
vjeux Nov 10, 2026
46bc0da
test(ContextMenu): coalesced late samples and an on-time move
vjeux Nov 10, 2026
cad79ec
fix(ContextMenu): judge each sample at its time, wait only when late
vjeux Nov 10, 2026
889aded
test(ContextMenu): moves held behind a block decide before the menu
vjeux Nov 11, 2026
45bfb44
fix(ContextMenu): a late menu timer waits for moves behind the block
vjeux Nov 11, 2026
d743922
test(ContextMenu): the press's page time comes from the arena's clock
vjeux Nov 11, 2026
cae3644
fix(ContextMenu): the press reads the page's time from the arena
vjeux Nov 11, 2026
03eb7d7
refactor(ContextMenu): the touch layer imports its recognizer directly
vjeux Nov 11, 2026
f37d633
test(ContextMenu): a drift queued behind a block still ends the hold
vjeux Nov 11, 2026
8575ec7
docs(records): why the press keeps its own wait, and outsidePress types
vjeux Nov 11, 2026
22ae97e
docs(ContextMenu): name the measured table and the moved default
vjeux Nov 11, 2026
7c8cb86
Merge main
vjeux Nov 11, 2026
56b2f62
test(ContextMenu): a finger in a second document on its own clock
vjeux Nov 11, 2026
650a125
Merge main
vjeux Nov 11, 2026
fac565a
docs(ContextMenu): the record owns the touch hold's two modules
vjeux Nov 11, 2026
69e6dd8
docs(ContextMenu): the hold's comments match what this code does
vjeux Nov 11, 2026
1375867
docs(layer-runtime): name the layer's prepare and releasePrepared
vjeux Nov 12, 2026
330fcc9
Merge main 6ab0c2ea11 into the press
vjeux Nov 12, 2026
dcfa0f8
Merge main 1740654b76 into the press
vjeux Nov 12, 2026
f0b0017
test(ContextMenu): a dropped render leaves the commit's mount alone
vjeux Nov 12, 2026
e5a2bc9
refactor(ContextMenu): no ref is written during render
vjeux Nov 12, 2026
3ea914d
docs(layer-runtime): the outside-press line names a touch's press too
vjeux Nov 11, 2026
86f89fd
docs(ContextMenu): two more comments match what this code does
vjeux Nov 11, 2026
9cccb47
docs(ContextMenu): the rest of the text matches what ships here
vjeux Nov 12, 2026
21f8156
docs(ContextMenu): the End-user row states the gap, not a status
vjeux Nov 12, 2026
e8d6326
Merge main 4d1cb828f6 into the press
vjeux Nov 12, 2026
d3621c0
Merge main 50beab9610 into the press
vjeux Nov 12, 2026
5adbafb
test(ContextMenu): the shift cases set how late the page gets the move
vjeux Nov 12, 2026
3632bb3
docs(layer-runtime): ContextMenu's menu uses the outside-press watch
vjeux Nov 12, 2026
26f36d3
docs(ContextMenu): FR10's gap names the hold ContextMenu times itself
vjeux Nov 12, 2026
68be391
test(ContextMenu): the late-move case bounds the wait from above
vjeux Nov 12, 2026
8e34400
Merge main 56680f6a7c into the press
vjeux Nov 12, 2026
06b982f
Merge main 36f68b0da0 into the press
vjeux Nov 13, 2026
21ffc1b
Merge main 4800d992eb into the press
vjeux Nov 14, 2026
9710f27
test(ContextMenu): a held finger on a Table header gets its menu there
vjeux Nov 14, 2026
85d7a36
fix(ContextMenu): a finger's point is measured from the anchor's box
vjeux Nov 14, 2026
bb998be
test(ContextMenu): a finger before the touch layer loads waits for it
vjeux Nov 14, 2026
30b6b1e
feat(ContextMenu): the touch layer loads after first paint
vjeux Nov 14, 2026
779d979
test(ContextMenu): a drift before the touch layer loads ends the press
vjeux Nov 15, 2026
ffa0950
fix(ContextMenu): a drift before the touch layer loads ends the press
vjeux Nov 15, 2026
c6208ca
docs(ContextMenu): the touch loader's comments in short sentences
vjeux Nov 15, 2026
df18912
Merge main 6d00dd56fd into the touch hold
vjeux Nov 15, 2026
e7c75e4
test(gestures): a late deadline waits for input queued behind a block
vjeux Nov 15, 2026
b547611
fix(gestures): a late deadline waits for input queued behind a block
vjeux Nov 15, 2026
7764661
test(ContextMenu): late finger's pointer, heard finger, failed load
vjeux Nov 15, 2026
b919d67
fix(ContextMenu): late finger keeps its pointer; failed load recovers
vjeux Nov 15, 2026
a458377
test(gestures): a deadline among a coalesced move's samples
vjeux Nov 15, 2026
6e45960
fix(gestures): a deadline among a coalesced move's samples runs between
vjeux Nov 15, 2026
1f848c9
test(gestures): a deadline due during a late wait runs as it ends
vjeux Nov 15, 2026
cf6fa67
fix(gestures): a deadline due during a late wait runs as it ends
vjeux Nov 15, 2026
104122d
Merge the arena's late-input handling into the touch hold
vjeux Nov 15, 2026
1a404c9
refactor(ContextMenu): leave late input to the gesture arena
vjeux Nov 15, 2026
d73fbbc
docs(layer-runtime): a popover ContextMenu judges a touch at its press
vjeux Nov 15, 2026
a14908d
docs(gestures): the late wait's comment and changeset in short sentences
vjeux Nov 15, 2026
81a658c
test(ContextMenu): load on the trigger window; failed load frees finger
vjeux Nov 15, 2026
fead7ee
fix(ContextMenu): load on the trigger's window; failed load frees finger
vjeux Nov 15, 2026
88132ea
docs(specs): FR16 states the late wait's cost for every recognizer
vjeux Nov 15, 2026
23afc6e
Merge the arena fix's short sentences and its cost line
vjeux Nov 15, 2026
640bbfa
test(gestures): a mouse keeps the late yield; a late wait ends once
vjeux Nov 15, 2026
b7e19e3
fix(gestures): only a finger or pen waits; a late wait ends once
vjeux Nov 15, 2026
320e8a3
Merge the arena fix's finger and pen gate into the touch hold
vjeux Nov 15, 2026
b411003
docs(gestures): the arena header's late-wait sentence in two
vjeux Nov 15, 2026
3503b02
docs(gestures): FR16 states the gate once; comments say why
vjeux Nov 15, 2026
ec2e905
Merge main 64806d0bd2 into the arena fix
vjeux Nov 15, 2026
f9c558f
Merge the arena fix's main merge into the touch hold
vjeux Nov 15, 2026
9e26c1e
docs(specs): the FR16 gap note names the finger-or-pen gate
vjeux Nov 15, 2026
db994d9
test(ContextMenu): the lift's click proof waits for the touch layer
vjeux Nov 15, 2026
fc46615
test(ContextMenu): a trigger mounting after a failed load loads nothing
vjeux Nov 15, 2026
c8446e5
fix(ContextMenu): after a failed load, only a touch asks again
vjeux Nov 15, 2026
9f7be4c
docs(ContextMenu): the pointer-order comment names no engine
vjeux Nov 15, 2026
fbe0c1c
chore(ContextMenu): the touch loader's per-copy state is allowed
vjeux Nov 15, 2026
add87da
perf(Layer): the public useLayer hides prepare() by type only
vjeux Nov 15, 2026
1acbd8b
test(ContextMenu): a trigger in another document loads nothing either
vjeux Nov 15, 2026
f4076cb
fix(ContextMenu): after a failed load, no window schedules another
vjeux Nov 15, 2026
9cfc2fa
docs(Layer): prepare() is hidden from useLayer's type, not its object
vjeux Nov 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/contextmenu-outside-press-watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@astryxdesign/core': patch
---

[fix] ContextMenu closes on an outside press through the layer's outside-press watch. A mouse or pen press closes it at its `mousedown`, in the menu's own document, so a menu in an iframe or a Picture-in-Picture window no longer closes on a press in the page.

@vjeux
7 changes: 7 additions & 0 deletions .changeset/contextmenu-touch-timeline.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@astryxdesign/core': patch
---

[feat] ContextMenu opens from a held finger on iOS 26's measured timeline where the primary pointer is coarse. The hold keeps UIKit's measured moments. At 400 ms the press takes the finger: its lift no longer sends a click, and the page cannot scroll under it. The menu opens at 735 ms if the finger is still down, or as soon as it lifts after 400 ms. A finger that lifts before 400 ms, or drifts more than 11.5 px on either axis before the menu opens, gets no menu. The page stays free to scroll while the menu is up: a touch outside the menu closes it as it begins to pan, or at its lift. A touch open lights no row: the menu itself takes the focus, as in UIKit (keyboard and pointer opens still focus the first item). A second finger cancels the press before 400 ms; after it, the menu still opens. A fine pointer (a mouse) keeps the right-click menu, and a finger there keeps today's 500 ms long press. The touch code loads after the page first paints, so a page's first load does not carry it; a finger held before then starts the hold once it loads. Pass `presentation="popover"` to keep today's menu: the menu at the pointer, opened by a finger held for 500 ms.

@vjeux
7 changes: 7 additions & 0 deletions .changeset/gesture-arena-late-input.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@astryxdesign/core': patch
---

[fix] A touch gesture's deadline now runs after the input stamped before it. Behind a blocked page, a finger's or pen's deadline whose timer runs more than 17 ms late waits 50 ms for input still queued. Each input from before it that comes late keeps it waiting. A mouse's or trackpad's deadline does not wait. A deadline that falls among a coalesced move's samples runs between them. A List reorder hold or a Pager's catch whose finger drifted or lifted in time now ends as it should.

@vjeux
69 changes: 69 additions & 0 deletions apps/storybook/stories/ContextMenu.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -647,3 +647,72 @@ export const BottomSheetSubmenu: Story = {
}
},
};

const touchStyles = stylex.create({
card: {
width: '200px',
height: '120px',
display: 'grid',
placeItems: 'center',
borderRadius: '12px',
backgroundColor: '#e5e7eb',
color: '#374151',
userSelect: 'none',
},
});

export const TouchLongPress: Story = {
name: 'Touch / long press',
parameters: {
docs: {
description: {
story:
'Where the primary pointer is coarse (a touch screen), hold a finger on the card. As on iOS, a haptic plays at 400 ms where the device can play one, and the menu opens at 735 ms, or as soon as the finger lifts after 400 ms. A finger that lifts before 400 ms, or drifts more than 11.5 px on either axis before the menu opens, gets no menu. While the menu is up, the page still scrolls: a touch outside the menu closes it as it begins to pan.',
},
},
},
render: () => (
<ContextMenu
data-testid="touch-context-menu"
label="Photo actions"
items={[
{label: 'Copy', icon: ClipboardIcon, onClick: () => {}},
{label: 'Share', icon: ShareIcon, onClick: () => {}},
{label: 'Save to Files', icon: ArrowDownTrayIcon, onClick: () => {}},
{type: 'divider'},
{
label: 'Delete',
icon: TrashIcon,
variant: 'destructive',
onClick: () => {},
},
]}>
<div {...stylex.props(touchStyles.card)}>Hold for actions</div>
</ContextMenu>
),
};

export const TouchLongPressPopover: Story = {
name: 'Touch / long press, presentation="popover"',
parameters: {
docs: {
description: {
story:
'With `presentation="popover"`, ContextMenu keeps today’s menu on every device: a finger held for 500 ms opens it at the finger, with no iOS timeline. A finger on a device whose primary pointer is fine (a mouse or a trackpad) gets the same long press.',
},
},
},
render: () => (
<ContextMenu
data-testid="touch-context-menu"
label="Photo actions"
presentation="popover"
items={[
{label: 'Copy', icon: ClipboardIcon, onClick: () => {}},
{label: 'Share', icon: ShareIcon, onClick: () => {}},
{label: 'Save to Files', icon: ArrowDownTrayIcon, onClick: () => {}},
]}>
<div {...stylex.props(touchStyles.card)}>Hold for actions</div>
</ContextMenu>
),
};
28 changes: 19 additions & 9 deletions docs/architecture/layer-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -381,22 +381,21 @@ Outside interaction is not coordinated by the shared stack. Current paths
close their own layers independently:

- auto popovers use native light dismiss;
- BaseTypeahead's list, DateInput's calendar, DateTimeInput's time list and
ChatComposerInput's trigger menu, manual popovers, use Layer's outside-press
watch,
- BaseTypeahead's list, DateInput's calendar, DateTimeInput's time list,
ChatComposerInput's trigger menu and ContextMenu's menu, manual popovers,
use Layer's outside-press watch,
which closes on a press that starts and ends outside the field and the list
and forgets a cancelled press (a scroll);
and forgets a cancelled press (a scroll); ContextMenu's menu judges the
press types it names at their `mousedown` (`pressTypes`);
- native dialogs handle backdrop clicks locally;
- ContextMenu uses a local outside `mousedown` listener, which skips the
compatibility mouse events of the finger press that opened the menu;
- Tooltip and HoverCard use hover/focus loss plus a touch-only outside listener;
- sheets own scrim and swipe behavior; and
- dropdown submenus encode their root-close relationship locally through
`DropdownMenuContext`.

One fact joins these paths, for a modal host's backdrop press
(`family:overlay-dismissal` FR11). The outside-press watch, the touch-only
outside listener, the text fields' blur closes, ContextMenu's `mousedown` close,
outside listener, the text fields' blur closes,
and a held Tooltip's focus-out release each record their close in a
per-document count. A Dialog or Drawer backdrop press that sees the count
change, or an auto popover close, between its pointer-down and its click leaves
Expand Down Expand Up @@ -835,6 +834,14 @@ it on the surface inside the layer and run no layout while it plays.

- `Layer/useLayer.tsx` owns Popover API lifecycle, state reconciliation,
anchor/fixed/custom rendering, trigger source, and current same-gesture memory.
It also owns two internal members of a context-mode layer, which
`useLayerInternal` returns and `useLayer`'s return type does not name.
With `lazyMount`, `prepare()` mounts the layer's content without showing it.
The popover stays closed, with no pixel and no accessibility node, and a
later `show()` only shows it. `releasePrepared()` unmounts that content
unless the layer has shown since. ContextMenu prepares its menu at a held
press's commit, so its first render does not fall inside the show at the
hold's display moment.
- `Layer/layerHost.ts` owns safe inline versus nearest corrective portal placement.
- `Layer/anchorName.ts` owns composition of anchor names on one trigger.
- `Layer/layerTextReset.stylex.ts` owns the text baseline and
Expand Down Expand Up @@ -893,8 +900,11 @@ it on the surface inside the layer and run no layout while it plays.
touch-only outside listener for Tooltip/HoverCard.
- `Layer/outsidePress.ts` owns the outside-press watch for a text field's
manual layer, used by BaseTypeahead, DateInput, DateTimeInput and
ChatComposerInput's trigger menu, and the per-document count of outside
closes that a modal backdrop press reads (`family:overlay-dismissal` FR11).
ChatComposerInput's trigger menu, and for ContextMenu's menu, which judges
Comment thread
astracat-bot[bot] marked this conversation as resolved.
Resolved
a mouse's or a pen's press as it goes down, and a touch's too under a fine
Comment thread
astracat-bot[bot] marked this conversation as resolved.
Resolved
pointer or with `presentation="popover"` (`pressTypes`). It also owns the
per-document count of outside closes that a modal backdrop press reads
(`family:overlay-dismissal` FR11).
- `DropdownMenuContext` and `DropdownMenuSubMenu` own the current local
menu-cascade parent-close chain.
- Dialog families own native modal/backdrop presentation and their local channel
Expand Down
Loading