Skip to content

Preview only — do not merge: #8201's ContextMenu lift to #9538's record - #12732

Draft
vjeux wants to merge 180 commits into
meta:mainfrom
vjeux:preview/contextmenu-lift-in-place-tint
Draft

vjeux wants to merge 180 commits into
meta:mainfrom
vjeux:preview/contextmenu-lift-in-place-tint

Conversation

@vjeux

@vjeux vjeux commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Preview only: this draft builds #8201's ContextMenu lift to the record in #9538, so the owners can try it on a phone before they decide. Do not merge; a maintainer closes it after the decision.

Try it: open /sandbox/pages/context-menu-lift/ on this pull request's preview deployment, then hold any row, card, cell or picture. The page labels what to look for.

What it shows:

  • A held finger lifts and zooms the trigger where it is, over a tint in the theme's overlay color, with no blur and no shadow.
  • The menu opens above or below the trigger where it fits, and never covers it. With room on neither side, it opens beside the trigger where its width fits. There it keeps its whole size, up to the screen's height, and slides to stay on screen. Otherwise it takes the roomier side, capped to fit, and a finger scrolls it.
  • A tap on the tint closes the menu.
  • The trigger never moves, at the screen's edges too.

This head: it merges #8201 (6f2621d) into #9538 (ae173c1). It then changes the lift so the trigger never moves and the menu never covers it. The lift places and caps its own menu. With the layer's fallbacks removed, the menu went off the screen before this change.

Position-try probe: a button at the bottom of the same page places eight boxes, one at a time, against a tall anchor. A control fits with no fallback. Four @position-try fallbacks then step toward the layer runtime's fit rule. P5 is that rule as the page receives it. P6 gives values to its variables, and P7 drops its env() insets. The page reports which apply, the viewport units and the safe-area insets.

Testing

  • Unit tests for the lift geometry and ContextMenu: 265 of 265 pass.
  • ContextMenu's browser specs, in Chromium with a phone-sized touch screen: 66 pass, 1 skipped.
  • The lift's browser specs in WebKit, in the Playwright container: 32 pass, 2 skipped.
  • With room on neither side: a short viewport, and a phone with a tall card, with and without the layer's fallbacks. Beside the trigger on a landscape phone: a low narrow trigger, and a thumbnail with a 300 px menu, with the browser's shift turned off. The tall-card case without the fallbacks, and every beside case, failed in Chromium and WebKit before the commit that fixes it; all pass after it.
  • A capped menu scrolls: its list has a scroll range and a finger's pan, in Chromium and WebKit. In Chromium, a real touch drag on a row scrolls it and the menu stays open. Each failed before the commit that fixes it.
  • Earlier cases: a card near the bottom, a card at the left edge in either direction.

cixzhang and others added 30 commits November 2, 2026 04:20
…very placement, per AST-059's anchor-clear order
progressCurve, mapProgress, mapRange and presentedProgressVelocity in
motion/progress.ts, internal, one velocity unit (progress per second).
Rebuilt on main from the pull request's own change, without the open
dependency chain it no longer needs.

Co-authored-by: Cindy Zhang <[email protected]>
…ressCurve

CodeBunny on meta#9755: springProgress solved the same spring as progressCurve.
It now reads progressCurve (remaining = 1 - progress), so one implementation
remains. Same curve, same settle epsilon (0.001) and duration.
…shows at each progress

lerpPath, edgeGrowPath, each path's restartFrom and morphCurves in
motion/morphPath.ts, internal. Pure geometry over a progress curve: the
caller chooses the timing. Rebuilt on the progress module from the pull
request's own change, without the open chain it no longer needs.

Co-authored-by: Cindy Zhang <[email protected]>
# Conflicts:
#	packages/core/src/motion/README.md
… source rect

createRectMorph in motion/rectMorph.ts, internal: present along a path and
dismiss back onto a copy or the element, each continuing the other from the
rect on screen. Rebuilt on main from the pull request's own change and
ported to main's engine (createMotionAnimator).

Timing follows the owner's rule for touch motion: present and dismiss take
a motion, either a theme duration and easing (a tap, a key, the program) or
a spring (a gesture's release, from its velocity). timedProgressCurve joins
the progress helpers. architecture:react-component-runtime INV12 records the
implementation gap: the size-change glide moves onto the morph next.

Co-authored-by: Cindy Zhang <[email protected]>
…opy dismissal

CodeBunny on meta#9769: a dismissal onto a copy detached the animator, and a
handed-in one was never attached again, so its owner's writes stopped
reaching the element. Only the morph's own animator lets go now.

Co-authored-by: Cindy Zhang <[email protected]>
…er and the morph

CodeBunny on meta#9769: solveAnimatedPageScroll already played this curve and
keeps the velocity of the move it retargets. timedCurve in progress.ts is
now that one curve; the pager and the morph's timed motion call it, so a
timed present that interrupts a dismissal keeps its velocity. The INV12
note states the system only. File header and comments trimmed.

Co-authored-by: Cindy Zhang <[email protected]>
CodeBunny on meta#9769: with nothing in flight the morph handed timedCurve a
velocity of 0, which it treats as a retarget and uses to cancel the
easing's starting slope. Only a motion in flight hands its velocity on now;
tests check a present from rest and a dismissal from a settled present
against the easing itself. Header and comments shortened.

Co-authored-by: Cindy Zhang <[email protected]>
The type's doc, the example and the changeset name no rule of their own
about which input plays which timing: each play takes the timing the
adopting component's motion record names (AST-094 FR45).

Co-authored-by: Christopher Chedeau <[email protected]>
A finger held on the trigger opens the menu on UIKit's timeline: the
hold commits at 400 ms and the menu shows at 735 ms. One outside-press
watch closes the menu for every pointer, and a touch closes it as it
begins to pan.

It carries this pull request's own diff from 6d7fceb, replayed on
main after meta#9814's squash, and folds these 12 commits (the history of
6d7fceb has each one):

- chore(motion): ContextMenu's touch timeline and press curve, measured
  on iOS 26.2
- test(ContextMenu): a held finger opens the menu on iOS 26's timeline,
  and a touch outside closes it as it pans
- feat(ContextMenu): open from a held finger on iOS 26's timeline, with
  no page lock
- docs(ContextMenu): FR11 cites AST-094 FR45 for the hold's measured
  moments
- test(ContextMenu): the long-press a11y contract follows the touch
  model
- docs(ContextMenu): the touch changeset and docs name their condition,
  not every touch device
- test(Layer): the outside-press watch closes a layer at the press for a
  mouse or a pen
- feat(Layer): the outside-press watch closes a layer at the press for a
  mouse or a pen
- refactor(ContextMenu): one outside-press watch closes the menu for
  every pointer, and its mousedown Effect goes
- docs(ContextMenu): split long file-header sentences
- test(Indicator): the ContextMenu box-hold case pins the popover menu
- test(ContextMenu): the long-press spec note keeps to 20 words
The hold's timer only sets ContextMenu's state, so React mounts and
shows the menu in its next scheduled task. A WebKit CI run showed it
at 758 ms, past the 735 ms proof's 20 ms. The proof now also wants the
menu to show inside the timer task that decides it, and that task at
the deadline counted from the touch. The page's stamps record the
first show only.
The hold's timer opened the menu with a plain state update, which waits
for React's next scheduled task: the menu showed 9 ms after the
deadline in Chromium and 17 ms in the WebKit CI container. UIKit shows
the menu at its moment. The open now commits with flushSync, in the
timer task, as a lift's open commits in the lift's dispatch.
The menu's first show mounts its layer, a render of 6 ms in Chromium
and 17 to 21 ms in the WebKit CI container inside the task that shows
the menu at 735 ms. UIKit prepares a context menu as the interaction
begins and only presents it at its moment. The proofs want the menu
mounted, closed and out of the accessibility tree, at the commit; the
same element shown at 735 ms or at the lift; and nothing left mounted
by a move past the tolerance or a cancel.
A lazy context layer gains prepare(), which mounts its content without
showing it, and releasePrepared(), which unmounts that content unless
the layer has shown since. Both are internal to core's layer hook. At
the hold's commit, ContextMenu prepares its layer, so the show at
735 ms or at the lift only reveals it. A press that ends with no menu
releases it. component:ContextMenu PR1 names the commit-time mount.
On main, ContextMenu's mouse and pen dismissal listens on the page's
document. A menu rendered into a same-origin iframe or a Document
Picture-in-Picture window then closes on a press in the page and stays
open on one in its own window. The shared outside-press watch listens
in the trigger's own document, as `family:overlay-dismissal` FR8 has
every member work in the document it renders in. With main's
ContextMenu.tsx, this case fails.
PR1 listed one mousedown listener and the adaptive query. While the
menu is open, the outside-press watch adds pointer listeners to the
trigger's document and shadow roots, plus a mousedown listener where a
mouse or a pen closes it at the press. With presentation omitted,
ContextMenu subscribes to the coarse-pointer query while mounted.
Under a finger, a block trigger grows from the onset, 150 ms after the
finger lands, toward 1.0735 times its size on springs.contextMenuLift,
and returns on springs.contextMenuDismiss.

It carries this pull request's own diff from 63c7a6c, replayed on
main after meta#9814's squash, and folds these 27 commits (the history of
63c7a6c has each one):

- test(ContextMenu): a held finger grows the trigger on the theme's
  motion tokens, and the timeline's other proofs
- feat(ContextMenu): a held finger grows the trigger on the theme's
  motion tokens
- test(ContextMenu): a trigger gets its size back when its press
  feedback goes while the menu it opened is up
- fix(ContextMenu): the press feedback attaches through useAttachment,
  and a departing feedback gives the trigger its size back
- refactor(ContextMenu): the touch layer's recognizer carries its
  transition listener, and the press recognizer drops onPressStart
- docs(ContextMenu): FR11's growth cites AST-094 FR45
- test(ContextMenu): the trigger returns on the theme's exit duration
  and easing when the menu closes
- fix(ContextMenu): the trigger returns on the theme's exit duration and
  easing when the menu closes
- docs(ContextMenu): FR11 keeps the measured basis for the hold's
  moments, and the tests that verify them
- docs(ContextMenu): the block-trigger guidance says the trigger grows
  while the menu is up
- test(ContextMenu): the growth starts 150 ms after the finger lands,
  wherever the press machine marks the press
- fix(ContextMenu): the growth starts 150 ms after the finger lands,
  wherever the press machine marks the press
- test(ContextMenu): the trigger's growth plays springs.contextMenuLift,
  and its returns springs.contextMenuDismiss
- fix(ContextMenu): the trigger's growth plays springs.contextMenuLift,
  and its returns springs.contextMenuDismiss
- docs(ContextMenu): FR11 names the block trigger, and the tests, story
  and comments say the trigger springs back
- refactor(ContextMenu): the press feedback stops returning the
  pressable marker, and two comments say what the code does
- test(ContextMenu): a right-click in a scaled container gives the
  anchor no scale of its own
- fix(ContextMenu): the anchor cancels only the press feedback's own
  growth
- fix(ContextMenu): the press feedback imports only its two springs
- test(ContextMenu): a drift the recognizer still follows grows at onset
- fix(ContextMenu): keep the growth's onset while the recognizer follows
- test(ContextMenu): a finger grows at its own onset, marked or not
- fix(ContextMenu): a finger arms the growth from its own landing
- docs(ContextMenu): the growth starts 150 ms after the finger lands
- refactor(ContextMenu): the recognizer times a finger's onset
- refactor(ContextMenu): drop a comment that restates followsFingerRef
- refactor(ContextMenu): the onset ref comment keeps only its constraint
main's hold now rejects a hold that names no judged motion. The curve
and storyboard proofs judge the trigger's scale, so they say so.
A touch that reaches the page 90 ms after its timestamp waits for
Chromium's timer hold, so the growth starts about 50 ms late, and its
back-dated curve skips its first frames. The proof wants the frame
before the growth at rest, the first grown frame no further along
than the spring one frame in, and that frame within two frames of the
onset.
Chromium holds every timer for about 100 ms after it handles a
touchstart, so a touch that reached the page late grew late, and its
back-dated curve skipped its first frames. The first frame at or after
the onset now starts the spring from rest. The motion engine is built
in the first frame after the finger lands, not in its touchstart
handler. A lift, a move past the tolerance, a cancel and the menu's
display stop the frame watch.
The proof read "the menu shows in the lift's task" as "within one
frame of the lift". Merged with main, the menu's render in that task
takes 17 ms in the WebKit CI container, so the time proxy failed while
the menu still showed before any frame. A page flag now records
whether the menu shows while the lift's listeners run.
Merged with main, the lazy-sheet bundle proof pins that a menu with an
on-demand sheet keeps the animator on demand. ContextMenu's touch
growth plays on the animator from the first touch, so the animator
loads with the menu. The proof now expects that for ContextMenu, and
`rideKeyboard` still loads only with the sheet.
A WebKit CI run showed the menu at 890 ms, inside the timer task that
decided it, so that task itself started late. The proof now logs the
page's frames. A deciding task that starts within a frame of its due
time keeps the 20 ms bound. A later start that a frame gap over 50 ms
covers fails with FrameStarvationError, its numbers named; any other
late start fails bare. The bound does not move.
Where a coarse pointer's held finger opens the menu, the same finger
slides onto an item, which lights under it, and its lift selects it. A
presentation="popover" or fine-pointer long press hands nothing over.

It carries this pull request's own diff from bc4efd0, replayed on
main after meta#9814's squash, and folds these 11 commits (the history of
bc4efd0 has each one):

- test(useMenuPress): a pointer that went down elsewhere is the menu's
  opening press
- feat(useMenuPress): a pointer that went down elsewhere is the menu's
  opening press
- test(ContextMenu): the finger a long press opened the menu under
  slides onto an item and its lift selects it
- feat(ContextMenu): the finger a long press opened the menu under
  slides onto an item, and its lift selects it
- docs(ContextMenu): FR12 records the slide onto an item after a long
  press opens the menu
- docs(ContextMenu): the slide's release note and docs say the menu
  opens at the finger
- docs(ContextMenu): FR12's slide follows a long press that opens the
  menu at the finger
- docs(ContextMenu): FR5 points the slide to FR13
- docs(core): useMenuPress's @output keeps main's sentence
- docs(ContextMenu): the slide changeset names where the slide applies
- docs(ContextMenu): the slide changeset covers adaptive popovers too
The 735 ms proof wants the menu to show inside the timer task that
decides it. Under Reduce Motion the menu opens on the same timer, so
its proof wants the same: the show inside that task, which starts at
the deadline counted from the touch.
- The lifted trigger grows about its center where it is. Near an edge
  it grows past the gutter instead of moving in.
- The menu is placed against the lifted box with its inline extent
  kept inside the gutter, so an aligned menu keeps the gutter and still
  clears the trigger.
- A lifted menu keeps its anchor clear: with room on neither side it
  goes beside the trigger, or caps itself on the roomier side.

Tests: the geometry cases for a source at each edge and a source
taller than the room, and the anchor box; browser cases for a card
near the bottom, at the left edge in either direction, and with room
on neither side.
The page names the five things to look for: the lift in place over
the theme's tint, no shadow, a menu above or below that never covers
the trigger, a tap on the tint closing it, and a trigger that never
moves. A card taller than the room for its menu shows the case with
room on neither side.
@vercel

vercel Bot commented Nov 18, 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 19, 2026 10:19pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟡 Reviewed (for maintainers only) Nov 19, 2026, 10:29 PM UTC

@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Nov 18, 2026
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 18, 2026
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 18, 2026
@github-actions

github-actions Bot commented Nov 18, 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

On phones, Chrome 145 and Safari 26.2 applied none of the layer
runtime's fallbacks for a lifted menu with room on neither side, so the
menu kept its own place, full height, off the screen.

The lift now places its own menu in the record's order: below or above
where it fits whole, else beside the trigger where its width fits, else
the roomier side, capped a pixel under the room. Its own place then
fits, so no fallback is needed. The layout effect measures the menu's
scroll height, so a cap never feeds back into its own size.

Tests: geometry cases for the cap, for beside at either inline side,
and for a cap beside; browser cases with room on neither side for a
short viewport, a phone with a tall card, and that phone with the
layer's fallbacks removed, as the phones behaved.
The tall card is 60svh. vh is the viewport with a phone's bars hidden,
so a 70vh card left far less room on a phone than on a desktop. Its
caption says what a phone shows.

A position-try probe places one box at a time against a tall anchor:
a control that needs no fallback, then four fallbacks that step toward
the layer runtime's fit rule. It also reports the viewport units, so a
phone can show which of those fallbacks it applies.
Beside the trigger, the menu aligned with the trigger's top and was
checked only against the room between the block gutters, so a low
trigger put it past the bottom gutter, where only a fallback could
move it. It now aligns with the trigger's top or its bottom, whichever
holds it whole inside the gutters, else the one with more room, capped
a pixel under it. An edge past a gutter aligns neither.

Tests: geometry cases for each alignment and for a cap beside; browser
cases beside a narrow trigger low on a landscape phone, with and
without the layer's fallbacks.

@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 touch lift mostly follows spec:AST-094 FR33, but nine problems need fixing whatever the owners decide about the record edits:

  • Beside the lifted trigger, the menu is capped to the room from the trigger's top or bottom edge instead of the viewport (liftFromTriggerGeometry.ts:197-219), so on a landscape phone a 300 px menu with 358 px free is cut to 263 px and scrolls, against spec:AST-059 FR4.
  • The lifted menu only fades in and never grows out of or shrinks back into its trigger (ContextMenuLift.ts:256), as spec:AST-094 FR31 and component:ContextMenu FR5 require.
  • motion/uikit/contextMenu.ts is a new internal module that five ContextMenu files import and no current record names (architecture:knowledge-contracts DEC-22), so it needs its usage, why it is needed and why motion/uikit/longPress.ts or motion/uikit/popover.ts is not enough, for an owner decision.
  • The touch open reads layout after writes two or three times in one task (liftFromTrigger.ts:907, ContextMenu.tsx:897-903, and again after a placement change), against architecture:react-component-runtime INV18.
  • Twelve latest-value refs are written during render (ContextMenu.tsx:627 and :657, ContextMenuLift.ts:224 and :227, ContextMenuTouchLayer.tsx:140-146 and :216-219, contextMenuPressFeedback.ts:134) instead of through useCommittedRef or useCommittedRefInto (INV3, INV17).
  • liftFromTrigger.ts:398, :736, :761 and :1191 write data-astryx-context-menu-lift names from a raw string, while architecture:public-component-api INV23 keeps every name and write in the owner privateAttributes/contextMenuLift.stylex.ts.
  • The ContextMenu presentation default change is outside this pull request's scope (no component scope in the title and no ## Scope line), so name ContextMenu in the scope or split it out.
  • UseMenuPressReturn.continueGesture is outside the scope too, so name useMenuPress in the scope or split it out.
  • liftCopy, hideSource and edgeGrowPath ship with no caller (liftFromTrigger.ts:1109-1225, motion/morphPath.ts:175), so remove them or move them to the pull request that adds their first consumer.

Approval also waits on owner decisions: an engineering owner records approval of the component:ContextMenu FR5, DD1 and DEC-2 changes, the module:DropdownMenu/useMenuPress FR11 sentence, the root-reachable continueGesture and the inner trigger box by commenting /approve-spec <full head SHA> on the pull request (the author may do so as an engineering owner), and cixzhang, the original decider, approves the changed DEC-2 Decider line in component:ContextMenu. The description also needs base and head first-load gzip for the docs, form, menu and table reference pages (INV10) and one text line per device or emulator run at this head (spec:AST-094 DEC-27).

Claims and files checked

Review mode: full; reason: over-500-lines

  • The trigger lifts in place over a tint with no blur and no shadow: verified (the lift adds a layer, an anchor and a placeholder; the touch story shows no shadow).
  • The menu opens above or below where it fits and never covers the trigger: verified (geometry tests; touch story capture).
  • With room on neither side it opens beside the trigger where its width fits: partly false, because beside the trigger it is capped to the room from the trigger's edge rather than the viewport.
  • Otherwise it takes the roomier side, capped, and scrolls: verified, though a trigger nearly as tall as the screen leaves a menu a few pixels tall.
  • A tap on the tint closes the menu: verified (liftFromTrigger.ts:853-862).
  • The trigger never moves, at the edges too: verified (the lift keeps the trigger's center and only scales it).
  • Unit tests pass: verified for the changed and related unit files (749 tests); the browser and WebKit specs were not rerun.
  • Changesets: the outside-press, timeline and slide-to-pick notes match the code; the touch-lift note omits the beside and capped placements; the lift-module note describes a grow the shipped menu does not use.
  • Files: all 74 changed files visited; source, records, changesets and scripts read in full, tests, stories and the sandbox page at the level of their cases; the findings above sit in the geometry, the ContextMenu touch files, the motion table and the lift module, and the other files have no blocking finding.

Automated review (maintainer link)

return lifted;
},
enterMenu(menu) {
lift.presentSurface(menu, null);

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.

With no press point, presentSurface starts the path at the menu's own box, so the menu only fades in, and nothing calls dismissSurface on close. spec:AST-094 FR31 and component:ContextMenu FR5 need the menu to grow out of the trigger and shrink back into it. Pass the edge point nearest the finger here, and close through dismissSurface before drop().

Comment on lines +140 to +146
feedbackRef.current = feedback;
const onOpenRef = useRef(onOpen);
onOpenRef.current = onOpen;
const onCommitRef = useRef(onCommit);
onCommitRef.current = onCommit;
const onCancelRef = useRef(onCancel);
onCancelRef.current = onCancel;

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.

These latest-value refs are written during render, so a render React discards still overwrites them (architecture:react-component-runtime INV3, INV17). Use useCommittedRef(value) here, and for the same pattern at lines 216-219, ContextMenuLift.ts:224 and :227, ContextMenu.tsx:627 and :657, and contextMenuPressFeedback.ts:134.

* Every leaf has one or more `@source`. A GUESS value also has the `@measure`
* task that confirms or replaces it. uikit.test.ts enforces both.
*/
export const contextMenu = {

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.

Five ContextMenu files import this new module, and no current record names it (architecture:knowledge-contracts DEC-22). Show its usage, why it is needed, and why motion/uikit/longPress.ts or motion/uikit/popover.ts is not enough, so an owner can decide it.

const layer = doc.createElement('span');
layer.setAttribute('popover', 'manual');
layer.setAttribute('aria-hidden', 'true');
layer.setAttribute(attribute, '');

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 lift writes data-astryx-context-menu-lift from a raw name, and derives -anchor and -placeholder from it at lines 736, 761 and 1191. architecture:public-component-api INV23 keeps every name and every write in the owner module, privateAttributes/contextMenuLift.stylex.ts. Have the owner export writers that the lift calls instead of the raw name.

* and drops it at the landing. Null, with nothing changed, for a source that
* is not in the page or has no box.
*/
export function liftCopy(

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.

liftCopy and hideSource have no caller outside tests, and neither has edgeGrowPath in motion/morphPath.ts:175. Remove them, or move them to the pull request that adds their first consumer.

Beside the trigger, the menu was capped to the room from the trigger's
top or bottom edge, so a menu that fit between the gutters could be cut
short and scroll. It now keeps its whole size, capped only to the room
between the block gutters, and its top slides from the trigger's top
as far as keeps it inside them. As the menu opens, the lift's anchor
takes the menu's block span once, and the start-aligned menu opens
there, so no browser shift or fallback has to move it.

Tests: geometry cases for the slide, the whole size on an 844 x 390
landscape phone, and the cap; browser cases beside a low narrow trigger
and beside that thumbnail, with the browser's shift turned off, with
and without the layer's fallbacks.

@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 menu beside the lifted trigger is fixed at this head: it now keeps its whole size and slides inside the gutters. Eight problems from the last review still need fixing whatever the owners decide about the record edits:

  • The lifted menu only fades in and never grows out of or shrinks back into its trigger (ContextMenuLift.ts:256), as spec:AST-094 FR31 and component:ContextMenu FR5 require.
  • motion/uikit/contextMenu.ts is a new internal module that five ContextMenu files import and no current record names (architecture:knowledge-contracts DEC-22), so it needs its usage, why it is needed and why motion/uikit/longPress.ts or motion/uikit/popover.ts is not enough, for an owner decision.
  • The touch open reads layout after writes in one task, and the layout effect now writes the anchor's top and height between its two read passes (liftFromTrigger.ts:907, ContextMenu.tsx:897-919), against architecture:react-component-runtime INV18.
  • Twelve latest-value refs are written during render (ContextMenu.tsx:627 and :657, ContextMenuLift.ts:224 and :227, ContextMenuTouchLayer.tsx:140-146 and :216-219, contextMenuPressFeedback.ts:134) instead of through useCommittedRef or useCommittedRefInto (INV3, INV17).
  • liftFromTrigger.ts:398, :736, :761, :1023 and :1191 write data-astryx-context-menu-lift names from a raw string, while architecture:public-component-api INV23 keeps every name and write in the owner privateAttributes/contextMenuLift.stylex.ts.
  • The ContextMenu presentation default change is outside this pull request's scope (no component scope in the title and no ## Scope line), so name ContextMenu in the scope or split it out.
  • UseMenuPressReturn.continueGesture is outside the scope too, so name useMenuPress in the scope or split it out.
  • liftCopy, hideSource and edgeGrowPath ship with no caller (liftFromTrigger.ts:1108-1225, motion/morphPath.ts:175), so remove them or move them to the pull request that adds their first consumer.

Approval also waits on owner decisions: an engineering owner records approval of the component:ContextMenu FR5, DD1 and DEC-2 changes, the module:DropdownMenu/useMenuPress FR11 sentence, the root-reachable continueGesture and the inner trigger box by commenting /approve-spec <full head SHA> on the pull request (the author may do so as an engineering owner), and cixzhang, the original decider, approves the changed DEC-2 Decider line in component:ContextMenu. The description also needs base and head first-load gzip for the docs, form, menu and table reference pages (INV10) and one text line per device or emulator run at this head (spec:AST-094 DEC-27).

Claims and files checked

Review mode: incremental; reason: none

  • The trigger lifts and zooms in place over a tint in the theme's overlay color, with no blur and no shadow: verified (the lift adds a layer, an anchor and a placeholder; no shadow element).
  • The menu opens above or below the trigger where it fits and never covers it: verified (geometry tests).
  • With room on neither side it opens beside the trigger where its width fits, keeps its whole size up to the screen's height and slides to stay on screen: verified (geometry tests; a landscape capture shows a 300 px menu whole beside a thumbnail).
  • Otherwise it takes the roomier side, capped to fit, and scrolls: verified, though a trigger nearly as tall as the screen leaves a menu a few pixels tall.
  • A tap on the tint closes the menu: verified (pointer listeners on the lift layer).
  • The trigger never moves, at the screen's edges too: verified (the moved anchor is a separate box that takes no pointer events; the captured thumbnail stays in place).
  • A position-try probe sits at the bottom of the sandbox page: present.
  • Unit tests pass: verified for the lift and ContextMenu unit files (262 tests); the browser and WebKit specs were not rerun.
  • Changesets: the outside-press, timeline and slide-to-pick notes match the code; the touch-lift note omits the beside and capped placements; the lift-module note describes a grow the shipped menu does not use.
  • Files: the four files the latest commit changes were read in full; the other 70 are unchanged since the last review and were rechecked for the findings above.

Automated review (maintainer link)

The lift capped the popover, but the menu's scroll container is the
list inside it. The popover clipped the list, the list had no scroll
range, and it kept the touch-action of a menu that fits, so a finger's
drag moved nothing and the last rows stayed out of reach. The cap now
goes on the list, which takes the overflow touch-action and contains
its overscroll while capped. The menu's whole size is read once per
open, before a cap holds it, so a later pass reads no layout.

Tests: the no-room cases check the list's own scroll range, overflow,
touch-action and a programmatic scroll. A new case drags a finger on a
capped menu's row, with touch events sent through the DevTools
protocol: the list scrolls and the menu stays open.

@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: a capped lifted menu now scrolls under a finger, but eight problems from the last review still need fixing whatever the owners decide about the record edits:

  • The lifted menu only fades in and never grows out of or shrinks back into its trigger (ContextMenuLift.ts:256), as spec:AST-094 FR31 and component:ContextMenu FR5 require.
  • motion/uikit/contextMenu.ts is a new internal module that five ContextMenu files import and no current record names (architecture:knowledge-contracts DEC-22), so it needs its usage, why it is needed and why motion/uikit/longPress.ts or motion/uikit/popover.ts is not enough, for an owner decision.
  • The touch open still reads the menu's box right after the lift's writes (liftFromTrigger.ts:907), and the flushSync commit and the layout effect's size read (ContextMenu.tsx:903-904) follow in the same task, so the open lays the page out twice against architecture:react-component-runtime INV18.
  • Twelve latest-value refs are written during render (ContextMenu.tsx:631 and :661, ContextMenuLift.ts:224 and :227, ContextMenuTouchLayer.tsx:140-146 and :216-219, contextMenuPressFeedback.ts:134) instead of through useCommittedRef or useCommittedRefInto (INV3, INV17).
  • liftFromTrigger.ts:398, :736, :761, :1023 and :1191 write data-astryx-context-menu-lift names from a raw string, while architecture:public-component-api INV23 keeps every name and write in the owner privateAttributes/contextMenuLift.stylex.ts.
  • The ContextMenu presentation default change is outside this pull request's scope (no component scope in the title and no ## Scope line), so name ContextMenu in the scope or split it out.
  • UseMenuPressReturn.continueGesture is outside the scope too, so name useMenuPress in the scope or split it out.
  • liftCopy, hideSource and edgeGrowPath ship with no caller (liftFromTrigger.ts:1109-1225, motion/morphPath.ts:175), so remove them or move them to the pull request that adds their first consumer.

Approval also waits on owner decisions: an engineering owner records approval of the component:ContextMenu FR5, DD1 and DEC-2 changes, the module:DropdownMenu/useMenuPress FR11 sentence, the root-reachable continueGesture and the inner trigger box by commenting /approve-spec <full head SHA> on the pull request (the author may do so as an engineering owner), and cixzhang, the original decider, approves the changed DEC-2 Decider line in component:ContextMenu. The description also needs base and head first-load gzip for the docs, form, menu and table reference pages (INV10) and one text line per device or emulator run at this head (spec:AST-094 DEC-27).

Claims and files checked

Review mode: incremental; reason: none

  • The trigger lifts and zooms in place over a tint in the theme's overlay color, with no blur and no shadow: verified (the lift adds a layer, an anchor and a placeholder; no shadow element).
  • The menu opens above or below the trigger where it fits and never covers it: verified (the placement order in the lift geometry and its tests).
  • With room on neither side it opens beside the trigger where its width fits, keeps its whole size up to the screen's height and slides to stay on screen: verified (the beside branch of the lift geometry and its tests).
  • Otherwise it takes the roomier side, capped to fit, and a finger scrolls it: verified at this head (the list takes the cap, auto overflow and a vertical pan; a new Chromium case drags a finger on a capped row), though a trigger nearly as tall as the screen leaves a list a few pixels tall.
  • A tap on the tint closes the menu: verified (pointer listeners on the lift layer).
  • The trigger never moves, at the screen's edges too: verified (the moved anchor is a separate box that takes no pointer events).
  • A position-try probe sits at the bottom of the sandbox page: present.
  • The head merges the two lift and record branches and then keeps the trigger in place: consistent with the head's history.
  • A capped menu's list has a scroll range and a finger's pan, and a real touch drag scrolls it with the menu open: the tests that assert it are present; each failing before the fix is consistent with the previous head's code; not rerun here.
  • Unit, Chromium and WebKit test counts: not rerun in this review.
  • Changesets: the outside-press, timeline and slide-to-pick notes match the code; the touch-lift note omits the beside, capped and scrolling placements; the lift-module note describes a grow the shipped menu does not use; the two motion notes match the internal modules.
  • Files: the latest commit's changes to its two files were read in full; the other 72 files are unchanged since the last review and were rechecked at the lines of the carried findings.

Automated review (maintainer link)

const element =
surfaceElement.closest<HTMLElement>('[popover]') ?? surfaceElement;
endSurface(current);
const rect = element.getBoundingClientRect();

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 box read still runs right after the lift writes the trigger's fixed position and shows its popovers, and the flushSync commit and the layout effect's size read (ContextMenu.tsx:903-904) follow in the same task, so the touch open lays the page out twice (architecture:react-component-runtime INV18). This head fixed the effect's second pass; to finish, take the one measurement in the layout effect and skip this read for a fade, which starts and ends at the menu's own box.

P5 is the layer runtime's fit rule as the page receives it. P6 and P7
keep the declarations a browser keeps from it: P6 with values for its
variables, P7 without env(). Each is placed against the same anchor
with 90 px of room, so a phone shows whether the shipped rule applies,
and if not, which part stops it. The units line adds the safe-area
insets and the resolved spacing variable.

@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 two commits since the last review extend the sandbox probe and reword one comment, so the eight problems from the last review still need fixing whatever the owners decide about the record edits:

  • The lifted menu only fades in and never grows out of or shrinks back into its trigger (ContextMenuLift.ts:256), as spec:AST-094 FR31 and component:ContextMenu FR5 require.
  • motion/uikit/contextMenu.ts is a new internal module that five ContextMenu files import and no current record names (architecture:knowledge-contracts DEC-22), so it needs its usage, why it is needed and why motion/uikit/longPress.ts or motion/uikit/popover.ts is not enough, for an owner decision.
  • The touch open reads the menu's box right after the lift's writes (liftFromTrigger.ts:907), and the flushSync commit and the layout effect's size read (ContextMenu.tsx:903-904) follow in the same task, so the open lays the page out twice against architecture:react-component-runtime INV18.
  • Twelve latest-value refs are written during render (ContextMenu.tsx:631 and :661, ContextMenuLift.ts:224 and :227, ContextMenuTouchLayer.tsx:140-146 and :216-219, contextMenuPressFeedback.ts:134) instead of through useCommittedRef or useCommittedRefInto (INV3, INV17).
  • liftFromTrigger.ts:398, :736, :761, :1023 and :1191 write data-astryx-context-menu-lift names from a raw string, while architecture:public-component-api INV23 keeps every name and write in the owner privateAttributes/contextMenuLift.stylex.ts.
  • The ContextMenu presentation default change is outside this pull request's scope (no component scope in the title and no ## Scope line), so name ContextMenu in the scope or split it out.
  • UseMenuPressReturn.continueGesture is outside the scope too, so name useMenuPress in the scope or split it out.
  • liftCopy, hideSource and edgeGrowPath ship with no caller (liftFromTrigger.ts:1109-1225, motion/morphPath.ts:175), so remove them or move them to the pull request that adds their first consumer.

Approval also waits on owner decisions: an engineering owner records approval of the component:ContextMenu FR5, DD1 and DEC-2 changes, the module:DropdownMenu/useMenuPress FR11 sentence, the root-reachable continueGesture and the inner trigger box by commenting /approve-spec <full head SHA> on the pull request (the author may do so as an engineering owner), and cixzhang, the original decider, approves the changed DEC-2 Decider line in component:ContextMenu. The description also needs base and head first-load gzip for the docs, form, menu and table reference pages (INV10) and one text line per device or emulator run at this head (spec:AST-094 DEC-27).

Claims and files checked

Review mode: incremental; reason: none

  • Changed rules (0): none.
  • The trigger lifts and zooms in place over a tint in the theme's overlay color, with no blur and no shadow: verified (a touch hold in Chromium shows the lifted trigger over the tint; the lift adds a layer, an anchor and a placeholder and no shadow element).
  • The menu opens above or below the trigger where it fits and never covers it: verified (the placement order in the lift geometry and its tests; the menu opens below the lifted trigger in the frame).
  • With room on neither side it opens beside the trigger where its width fits, keeps its whole size up to the screen's height and slides to stay on screen: verified (the beside branch caps only to the screen less its gutters and slides the menu's start so it fits).
  • Otherwise it takes the roomier side, capped to fit, and a finger scrolls it: verified (the list takes the cap, auto overflow and a vertical pan), though a trigger nearly as tall as the screen leaves a list a few pixels tall.
  • A tap on the tint closes the menu: verified (pointer listeners on the lift layer).
  • The trigger never moves, at the screen's edges too: verified (the moved anchor is a separate box that takes no pointer events).
  • The probe places eight boxes one at a time against a tall anchor, a control with no fallback and fallbacks that step toward the layer's fit rule: verified (a control plus seven probes in the page's list).
  • The fifth probe is the layer's own fit rule as the page receives it, the sixth gives its variables values and the seventh drops its safe-area insets: verified (the fifth matches the layer runtime's below fit rule declaration for declaration).
  • The head merges the lift and record branches and then keeps the trigger in place: consistent with the head's history.
  • Unit tests for the lift geometry and ContextMenu pass: verified (the ContextMenu, lift and shared-module unit suites pass at this head); the Chromium and WebKit browser spec counts and their before-fix failures were not rerun.
  • Changesets: the outside-press, timeline and slide-to-pick notes match the code; the touch-lift note omits the beside, capped and scrolling placements; the lift-module note describes a grow the shipped menu does not use; the two motion notes match the internal modules.
  • Files: the two commits' changes to the sandbox page and ContextMenu.tsx were read in full; the other 72 files are unchanged since the last review and were rechecked at the lines of every carried finding.

Automated review (maintainer link)

This branch was successfully deployed

1 active deployment
Preview — 398e4d05 Deployed Nov 19, 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. needs:design-review Affects visuals — Design should review needs:spec-owner-review Current knowledge records await owner approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants