Skip to content

fix(Layer): a touch presentation's input hold ends where its entrance ends - #13785

Draft
vjeux wants to merge 3 commits into
meta:mainfrom
vjeux:hold-release-at-rest
Draft

vjeux wants to merge 3 commits into
meta:mainfrom
vjeux:hold-release-at-rest

Conversation

@vjeux

@vjeux vjeux commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

User impact

Under a finger, a tap or a pan outside an open menu can do nothing after its entrance has drawn. It happens when the main thread is busy as the entrance ends. The tap leaves the menu open, and the pan does not scroll.

Problem and solution fit

  • The press lands on the input hold's shield, which still covers the page.
  • The shield goes only when the main thread runs the motion's release: a timer after the curve's end, or the next frame's promise.
  • A busy main thread runs them late. A press dispatched before them is held, as if the menu still entered.

Expected behavior and authority

spec:AST-094 FR35: "A presentation takes no input while it enters." It holds "a tap or a drag that lands while a touch presentation is still entering".

architecture:layer-runtime INV16 gives that hold to the layer runtime. A press after the entrance ends is outside both.

Smallest restoration

  • Layer/inputHold.ts: a presenting hold ends in the first frame past its entrance's end, even when timers run late. A marker animation with no target waits out the entrance, so it asks for no frame before then.
  • A press stamped after that end also ends the hold, before the press is judged. The end comes from the hold's motion or the layer's animations.
  • motion/animator.ts records each run's curve end. motion/curveEnds.ts owns the shared curve-end map that the animator writes and the input hold reads (spec:AST-110 FR3). INV16 names it.
  • A press during the entrance, or before it starts, is held as before.

Known limit: a pan whose first touch lands on such a shield, with no frame drawn since the entrance ended, cannot scroll in that gesture. The browser takes its scrolling from the shield. The menu still closes, and the next pan scrolls.

Evidence

  • Reproduction before the change: new DropdownMenu specs hold the page's timers while frames run. At rest, an outside tap leaves the menu open, and an outside pan does not scroll (test).
  • Result after the change: they pass 10 of 10 runs in Chromium (test).
  • Representative unchanged path: a tap during the entrance is still ignored (test).
  • Regression test or other mutation-sensitive proof: four new inputHold unit cases fail without the change and pass with it (test).

Scope

Components: motion animator, Layer input hold, INV16 of architecture:layer-runtime

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

All runs are in Chromium unless named, with no retries.

  • pnpm test:interaction packages/core/src/DropdownMenu/__tests__/DropdownMenuEntranceHold.interaction.browser.spec.ts --project chromium -g "timers run late" --repeat-each=5: on main with only the new specs, 10 of 10 fail. With the change, 10 of 10 pass (test).
  • pnpm exec vitest run --project ui packages/core/src/Layer/inputHold.test.tsx: on main with only the new cases, 4 of 7 new cases fail. With the change, all pass (test).
  • Two of those cases cover an entrance that moves its end later, and a close during the entrance. Each fails on a variant without that handling (test).
  • A local spec, not in this pull request, blocks the main thread for 1 s across the entrance's end. It sends an outside tap during the block. On main, the tap is held in 14 of 20 runs. With the change, it is held in 0 of 20 (test).
  • The unit tests of Layer, motion, DropdownMenu, Popover and List pass: 118 files, 2,728 tests (test).
  • Two trace specs keep compositor motion off the main thread. ChatLayoutKeyboard's "the rise does no Layout or Paint per frame" passes 5 of 5 (test). RefreshControl's "the settle does no Layout or Paint per frame" passes 5 of 5 (test).
  • scripts/snap-paging-bundle.test.mjs counts motion/curveEnds.ts as the pager's motion, beside the animator that imports it.
  • motion/curveEnds.ts is internal: nothing from it is exported from @astryxdesign/core. The repo's API report, scripts/api-report/cli.mjs, shows no change to its public API (test).
  • This changes Layer/inputHold.ts, as fix(DropdownMenu): a finger's touch outside only closes the menu #12216 does. Whichever lands second is merged onto the other, and its tests run again.
  • Before the WebKit skip and a changeset's blank line were added, the strict pnpm preflight --browser read "ready to flip". Every check passed, the unit, accessibility and interaction suites included (test).
  • The full Chromium interaction suite: 1,986 passed and 54 skipped with the change, and 1,984 passed and 54 skipped on main. None fails (test).
  • The full WebKit interaction suite with the change, before the skip below: 1,704 passed, 335 skipped and 1 failed, the new pan case (test). On main: 1,703 passed and 335 skipped (test).
  • In WebKit, the new pan case is skipped: "a scripted touch scrolls the page only through Chromium’s input pipeline". Its tap twin passes there (test).

Owner decision

The record line naming motion/curveEnds.ts, a new internal module that two others import, awaits an engineering owner's /approve-spec (architecture:knowledge-contracts DEC-22).

Writing rubric results

Run over the two sentences this change adds to INV16 of architecture:layer-runtime.

  • R1 narration: none; both sentences state what the hold and the animator do, in the present tense.
  • R2 research: none; the measurements stay in this pull request.
  • R3 evidence: no evidence or verification cell changed.
  • R4 rejected alternatives: none added.
  • R5 change references: none.
  • R6 open questions: none added.
  • R7 project status: none.

@vercel

vercel Bot commented Nov 25, 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 25, 2026 12:35pm UTC

Request Review

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

astracat-bot Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟡 Reviewed (for maintainers only) Nov 25, 2026, 12:44 PM UTC

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 25, 2026
@cixzhang cixzhang added ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) labels Nov 25, 2026
@github-actions

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

… ends

Under a finger, a tap or a pan outside a menu that has drawn its whole
entrance could do nothing. The input hold's shield stayed over the page
until the main thread ran the motion's release: a timer after the curve's
end, or a promise the next frame resolves. A busy main thread ran them late,
and a press the browser dispatched first was held as if the menu still
entered.

The input hold now ends a layer's presenting holds in the first frame past
the entrance's end, even when timers run late. A marker animation with no
target waits out the entrance in its delay, so it asks for no frame before
that end. Each look reads the end again, so a retargeted entrance keeps
its hold to the new end, and a marker ends only the hold it was armed
for. A press stamped after that end also ends them, before the press
is judged. A press while the entrance runs is held, as before.

The entrance end is read from the layer's animations. The motion animator
records each run's curve end, and each handle's once its start is known, in
motion/curveEnds.ts, which the input hold reads without the animator. The
snap paging bundle test counts that module as the pager's motion.

A pan whose first touch lands on such a shield, with no frame drawn since
the entrance ended, still cannot scroll in that gesture: the browser takes
the gesture's scrolling from the shield as the touch starts. The menu
closes, and the next pan scrolls.

@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 fix keeps the touch-presentation rule that only an entering presentation holds input, and the release note now matches what the new tests prove, but one point needs an owner decision before approval:

  • packages/core/src/motion/curveEnds.ts is a new internal module that Layer/inputHold.ts imports from outside motion/, and no current record names it (architecture:knowledge-contracts DEC-22), so it needs an engineering owner's API decision, including why the motion foundation's existing motion/presentation.ts registry is not the place for a curve-end entry.

The INV16 amendment in docs/architecture/layer-runtime.md that names the module is itself a record change waiting for the same decision: an engineering owner records it by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner. One non-blocking wording suggestion for a comment in inputHold.ts is inline.

Claims and files checked

Review mode: full; reason: history

Claims:

  • Release note, a tap or a pan outside a menu acts from the first frame drawn after the entrance ends, even when timers run late: verified in code (inputHold.ts:670-719, :644-661) and matched by the new specs, which hold page timers while frames run (DropdownMenuEntranceHold.interaction.browser.spec.ts:418-491).
  • Release note, the hold no longer covers the page until those timers run: verified (inputHold.ts:699-708).
  • The press lands on the hold's shield, which stays until a timer or a next-frame promise releases it: verified (inputHold.ts:312-354, :595-596; animator.ts:2305; usePopoverSurfaceMotion.ts:105).
  • A presenting hold ends in the first frame past its entrance's end, through a marker animation with no target: verified (inputHold.ts:699-708); that the marker asks for no frame before its end is engine scheduling that the tests do not show.
  • A press stamped after that end ends the hold before it is judged: verified (inputHold.ts:1254-1256, :1318-1320).
  • The end comes from the hold's motion or the layer's animations: verified (inputHold.ts:653-655, :688-690).
  • The animator records each run's curve end, and the curve-end map is shared under a versioned key: verified (animator.ts:2304, :3366; curveEnds.ts:20-23).
  • INV16 names the module: verified (layer-runtime.md:693-696), not yet approved.
  • A press during the entrance, or before it starts, is held as before: verified (inputHold.ts:616-623, :656; inputHold.test.tsx:595, :606).
  • Known limit, a pan that starts on the shield before any frame past the end cannot scroll in that gesture: consistent with the shield's touch action (inputHold.ts:332).
  • The pan spec is skipped outside Chromium, and its tap twin runs everywhere: verified (DropdownMenuEntranceHold.interaction.browser.spec.ts:449-452, :418).
  • The pager bundle test counts the new module as the pager's motion: verified (scripts/snap-paging-bundle.test.mjs:36).
  • The new module is internal and the public API is unchanged: verified from the package exports and the source diff.
  • No new public API, default or interaction model under the fix label, and no internal context in public text: verified.
  • The INV16 sentences carry no narration, status or change references: verified (layer-runtime.md:693-696).
  • The coordination note about another open pull request that edits inputHold.ts: a process note, not a code claim.
  • The stated pass and fail counts (red-first specs and unit cases, the unit, interaction and trace suites, and the busy-main-thread local spec): not reproduced; CI has not run on this draft.

Files:

  • .changeset/input-hold-entrance-end.md: clear.
  • docs/architecture/layer-runtime.md: waits for an engineering owner's approval.
  • packages/core/src/DropdownMenu/__tests__/DropdownMenuEntranceHold.interaction.browser.spec.ts: clear.
  • packages/core/src/Layer/inputHold.test.tsx: clear.
  • packages/core/src/Layer/inputHold.ts: clear, with one non-blocking comment suggestion.
  • packages/core/src/motion/animator.ts: clear.
  • packages/core/src/motion/curveEnds.ts: finding (needs an owner API decision).
  • scripts/snap-paging-bundle.test.mjs: clear.

Automated review (maintainer link)

* curves end once its start is known. An animation's effect runs on past that
* end, holding the end value, so its own timing does not tell.
*/
export const curveEnds = sharedWeakMap<object, number>(

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.

Layer/inputHold.ts imports this module from outside motion/, so it is API between components, and no current record names it (architecture:knowledge-contracts DEC-22). It needs an engineering owner's decision: approving the INV16 amendment with /approve-spec <full head SHA>, or naming the existing module, such as motion/presentation.ts, that should carry the curve end instead.

Comment on lines +603 to +606
* at the end of the held tail after it. Null while none runs, or while any
* one has no end that can be read: one not started yet, one that repeats
* without end (a spinner in the menu), or one played backward. Then the hold
* waits for its own release.

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: this is one sentence of more than 25 words with three topics. Suggested:

 * at the end of the held tail after it. Null while no animation runs. Null
 * also while an animation has no readable end: it has not started, it
 * repeats without end (a spinner in the menu), or it plays backward. Then
 * the hold waits for its own release.

This branch was successfully deployed

1 active deployment
Preview — 57b6adba Deployed Nov 25, 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:spec-owner-review Current knowledge records await owner approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants