{renderedLayer}
@@ -1204,6 +1210,60 @@ describe('useLayer', () => {
expect(layer).toHaveAttribute('data-open', 'true');
});
+ it('prepare() mounts it closed, and the next show opens that element at once', async () => {
+ const showSpy = mockPopover();
+ const {container, getByRole} = render(
);
+
+ fireEvent.click(getByRole('button', {name: 'Prepare'}));
+ await waitFor(() => {
+ expect(container.querySelector('[popover]')).not.toBeNull();
+ });
+ const layer = container.querySelector('[popover]');
+ expect(layer).not.toHaveAttribute('data-open');
+ expect(showSpy).not.toHaveBeenCalled();
+
+ fireEvent.click(getByRole('button', {name: 'Trigger'}));
+ // Mounted: shown within the call, not after a commit.
+ expect(showSpy).toHaveBeenCalledOnce();
+ expect(container.querySelector('[popover]')).toBe(layer);
+ expect(layer).toHaveAttribute('data-open', 'true');
+ });
+
+ it('releasePrepared() unmounts a prepared layer that never showed', async () => {
+ const showSpy = mockPopover();
+ const {container, getByRole} = render(
);
+
+ fireEvent.click(getByRole('button', {name: 'Prepare'}));
+ await waitFor(() => {
+ expect(container.querySelector('[popover]')).not.toBeNull();
+ });
+ fireEvent.click(getByRole('button', {name: 'Release'}));
+
+ await waitFor(() => {
+ expect(container.querySelector('[popover]')).toBeNull();
+ });
+ expect(container.querySelector('template')).not.toBeNull();
+ expect(showSpy).not.toHaveBeenCalled();
+ });
+
+ it('releasePrepared() keeps a prepared layer that has shown since', async () => {
+ mockPopover();
+ const {container, getByRole} = render(
);
+
+ fireEvent.click(getByRole('button', {name: 'Prepare'}));
+ await waitFor(() => {
+ expect(container.querySelector('[popover]')).not.toBeNull();
+ });
+ const layer = container.querySelector('[popover]');
+ fireEvent.click(getByRole('button', {name: 'Trigger'}));
+ fireEvent.click(getByRole('button', {name: 'Close'}));
+ fireEvent.click(getByRole('button', {name: 'Release'}));
+
+ await act(async () => {});
+ expect(container.querySelector('[popover]')).toBe(layer);
+ expect(layer?.isConnected).toBe(true);
+ });
+
it('without the option, a lazy layer still unmounts on hide', async () => {
mockPopover();
const {container, getByRole} = render(
diff --git a/packages/core/src/Layer/useLayer.tsx b/packages/core/src/Layer/useLayer.tsx
index 710cdb1f948d3..0607feb23d905 100644
--- a/packages/core/src/Layer/useLayer.tsx
+++ b/packages/core/src/Layer/useLayer.tsx
@@ -575,6 +575,23 @@ export interface FixedLayerReturn {
render: (children: ReactNode, props: FixedRenderProps) => ReactNode;
}
+/** Context-mode members a core component may use through `useLayerInternal`. */
+interface InternalContextLayerFields {
+ /**
+ * With `lazyMount`, mounts the layer's content without showing it. The
+ * popover stays closed, so it shows no pixel and is out of the accessibility
+ * tree until `show()`, which then only shows it. A caller that knows a show
+ * is coming spares that show the first mount's render. Does nothing for a
+ * layer that is mounted already.
+ */
+ prepare: () => void;
+ /**
+ * Unmounts what `prepare()` mounted, unless the layer has shown since. A
+ * layer that has shown keeps its mount as its options say.
+ */
+ releasePrepared: () => void;
+}
+
/**
* Context-mode render props a core component may pass through
* `useLayerInternal`; they are not part of `useLayer`'s public API.
@@ -590,10 +607,8 @@ interface InternalContextRenderProps extends ContextRenderProps {
}
/** What `useLayerInternal` returns in context mode. */
-interface InternalContextLayerReturn extends Omit<
- ContextLayerReturn,
- 'render'
-> {
+interface InternalContextLayerReturn
+ extends Omit
, InternalContextLayerFields {
render: (
children: ReactNode,
props?: InternalContextRenderProps,
@@ -1431,7 +1446,7 @@ export function useKeepLayerOpenProps(
*/
function useLayerImplementation(
options: InternalContextLayerOptions | FixedLayerOptions,
-): ContextLayerReturn | FixedLayerReturn {
+): InternalContextLayerReturn | FixedLayerReturn {
const {mode, onShow, onHide, lightDismiss = false} = options;
const lazyMount = mode === 'context' ? (options.lazyMount ?? false) : false;
const keepsMountAfterShow =
@@ -1788,6 +1803,30 @@ function useLayerImplementation(
[mountStore],
);
+ // The mount came from `prepare()`, and the layer has not shown since.
+ const isMountPreparedRef = useRef(false);
+
+ const prepare = useCallback(() => {
+ if (mode !== 'context' || !lazyMount || contextMountRef.current != null) {
+ return;
+ }
+ isMountPreparedRef.current = true;
+ requestContextMount();
+ }, [mode, lazyMount, requestContextMount]);
+
+ const releasePrepared = useCallback(() => {
+ if (
+ !isMountPreparedRef.current ||
+ pendingShowRef.current ||
+ isOpenRef.current
+ ) {
+ return;
+ }
+ isMountPreparedRef.current = false;
+ contextMountRef.current = null;
+ mountStore.set(null);
+ }, [mountStore]);
+
const clearContextMount = useCallback(() => {
if (mode !== 'context' || !lazyMount || keepsMountAfterShow) {
return;
@@ -1838,6 +1877,7 @@ function useLayerImplementation(
isOpenRef.current = false;
stopOutsideWatch();
}
+ isMountPreparedRef.current = false;
// A context popover left over until React commits a previous hide must not
// be reopened. The synchronous mount ref is the source of truth.
const candidate = popoverRef.current;
@@ -2959,17 +2999,29 @@ function useLayerImplementation(
[popoverRefCallback, id, lightDismiss],
);
- const contextResult = useMemo(
+ const contextResult = useMemo(
() => ({
ref: contextRef,
anchorId,
show,
hide,
isOpen,
+ prepare,
+ releasePrepared,
id,
render: renderContext,
}),
- [contextRef, anchorId, show, hide, isOpen, id, renderContext],
+ [
+ contextRef,
+ anchorId,
+ show,
+ hide,
+ isOpen,
+ prepare,
+ releasePrepared,
+ id,
+ renderContext,
+ ],
);
const fixedResult = useMemo(
() => ({
@@ -2991,6 +3043,8 @@ export function useLayer(options: FixedLayerOptions): FixedLayerReturn;
export function useLayer(
options: ContextLayerOptions | FixedLayerOptions,
): ContextLayerReturn | FixedLayerReturn {
+ // Only the type hides the internal members. Stripping them at runtime
+ // would cost every page that uses a layer.
return useLayerImplementation(options);
}
diff --git a/packages/core/src/Table/__tests__/TableCellMenus.a11y.browser.spec.ts b/packages/core/src/Table/__tests__/TableCellMenus.a11y.browser.spec.ts
index 52b80f874982e..0daf91d4ec2b0 100644
--- a/packages/core/src/Table/__tests__/TableCellMenus.a11y.browser.spec.ts
+++ b/packages/core/src/Table/__tests__/TableCellMenus.a11y.browser.spec.ts
@@ -48,6 +48,26 @@ async function mount(page: Page, story: string, args = '', timeout = 5000) {
});
}
+/** The ContextMenu touch layer's own chunk, which loads after first paint. */
+const TOUCH_LAYER_CHUNK = /\/ContextMenuTouchLayer-[\w-]+\.js(?:\?.*)?$/;
+
+/**
+ * Waits for the touch layer: its chunk's response, the module itself, then two
+ * frames for the layer to mount.
+ */
+async function waitForTouchLayer(
+ page: Page,
+ chunk: ReturnType,
+): Promise {
+ const url = (await chunk).url();
+ await page.evaluate(async layerUrl => {
+ await import(layerUrl);
+ await new Promise(resolve => {
+ requestAnimationFrame(() => requestAnimationFrame(() => resolve()));
+ });
+ }, url);
+}
+
/** A body cell's text, away from its expansion toggle. */
const nameCell = (page: Page) =>
page.locator('.astryx-table-scroll-wrapper tbody td').nth(1);
@@ -195,7 +215,14 @@ test.describe('on a touch screen', () => {
test('a long press held through a busy main thread still opens the menu at the finger (spec:AST-094 FR16)', async ({
page,
}) => {
+ const touchLayer = page.waitForResponse(response =>
+ TOUCH_LAYER_CHUNK.test(response.url()),
+ );
await mount(page, 'gliding-rows');
+ // A finger that lands before the touch layer loads starts its hold only
+ // at the layer's mount. The busy task below would hold that mount past
+ // the lift, so the finger lands once the layer has loaded.
+ await waitForTouchLayer(page, touchLayer);
const cell = nameCell(page);
const box = await cell.boundingBox();
if (box == null) {
diff --git a/packages/core/src/gestures/GestureArena.ts b/packages/core/src/gestures/GestureArena.ts
index 62bf6d03374cd..2df9ab5057eed 100644
--- a/packages/core/src/gestures/GestureArena.ts
+++ b/packages/core/src/gestures/GestureArena.ts
@@ -36,7 +36,10 @@
* timestamp runs first, at its own deadline. A long press therefore begins at
* exactly touch-down + 500 ms even when the main thread was blocked and the
* timer callback came late, and a test drives the whole machine with explicit
- * timestamps and no real time at all.
+ * timestamps and no real time at all. A deadline whose timer runs late waits
+ * while input from before it still reaches the page late. That holds only
+ * while the latest contact is a finger or a pen. A deadline among a coalesced
+ * move's samples runs between them.
*
* SYNC: When modified, update GestureRecognizer.ts and
* __tests__/arena.test.ts.
@@ -52,12 +55,31 @@ import type {
GestureEventContext,
GestureState,
GestureTouch,
+ PointerKind,
TouchBeganInput,
TouchConsumer,
TouchInput,
TouchSample,
} from './types';
import {DEFAULT_ENVIRONMENT} from './types';
+
+/**
+ * A deadline's timer counts as late when it runs this long after it was due.
+ * In ms: one frame at 60 Hz.
+ */
+const LATE_TIMER_MS = 17;
+
+/**
+ * An input counts as late when it reaches the page this long after its own
+ * time. In ms: two frames at 60 Hz.
+ */
+const LATE_INPUT_MS = 33;
+
+/**
+ * How long a late deadline waits for input still queued before it. In ms:
+ * three frames at 60 Hz.
+ */
+const LATE_INPUT_WAIT_MS = 50;
import {internals} from './recognizerInternals';
export interface GestureClock {
@@ -162,6 +184,18 @@ export class GestureArena {
private currentTime: number | null = null;
/** The latest time processed: input never moves the clock backwards. */
private latestTime = Number.NEGATIVE_INFINITY;
+ /** The latest input that reached the page late: its own time, and when. */
+ private lateInput: {time: number; arrivedAt: number} | null = null;
+ /**
+ * A late deadline waits for queued input only while this is true. A mouse
+ * keeps the one-task yield.
+ */
+ private isLatestContactFingerOrPen = false;
+ /**
+ * When the latest wait for queued input ended with none still coming late.
+ * A deadline that came due during that wait is not late on its own.
+ */
+ private quietSince = Number.NEGATIVE_INFINITY;
private depth = 0;
/** Open `deferResolution` calls: what their stops unblock waits. */
private deferDepth = 0;
@@ -181,6 +215,14 @@ export class GestureArena {
return this.currentTime ?? Math.max(this.latestTime, this.clock.now());
}
+ /**
+ * The injected clock's own reading: when the page runs now. Behind a block,
+ * the event clock lags it.
+ */
+ pageTime(): number {
+ return this.clock.now();
+ }
+
/** Whether a recognizer owns this touch, so the browser must not pan or zoom it. */
isClaimed(id: number): boolean {
return this.records.get(id)?.isClaimed === true;
@@ -222,6 +264,13 @@ export class GestureArena {
if (inputs.length === 0) {
return;
}
+ this.isLatestContactFingerOrPen = isFingerOrPen(
+ inputs[inputs.length - 1].pointerType,
+ );
+ this.noteArrival(
+ inputs[0].time,
+ inputs.some(input => isFingerOrPen(input.pointerType)),
+ );
this.run(inputs[0].time, () => {
const newTouches = new Map();
const created: TouchRecord[] = [];
@@ -238,6 +287,10 @@ export class GestureArena {
x: input.x,
y: input.y,
time,
+ inputSamples: [
+ ...(input.history ?? []),
+ {x: input.x, y: input.y, time: input.time},
+ ],
startX: input.x,
startY: input.y,
startTime: time,
@@ -316,6 +369,8 @@ export class GestureArena {
* gesture hear of it, as of any touch off their hit path.
*/
untrackedBegan(input: TouchBeganInput): void {
+ this.isLatestContactFingerOrPen = isFingerOrPen(input.pointerType);
+ this.noteArrival(input.time, this.isLatestContactFingerOrPen);
if (!this.active.some(recognizer => recognizer.numberOfTouches > 0)) {
return;
}
@@ -328,6 +383,7 @@ export class GestureArena {
x: input.x,
y: input.y,
time,
+ inputSamples: [{x: input.x, y: input.y, time: input.time}],
startX: input.x,
startY: input.y,
startTime: time,
@@ -350,6 +406,31 @@ export class GestureArena {
if (inputs.length === 0) {
return;
}
+ this.noteArrival(
+ inputs[0].time,
+ inputs.some(input => this.isFingerOrPenContact(input.id)),
+ );
+ // A coalesced move carries the samples since the previous one. A deadline
+ // among them runs between them: the samples stamped before it come first.
+ let rest = inputs;
+ for (
+ let deadline = this.deadlineAmong(rest);
+ deadline != null;
+ deadline = this.deadlineAmong(rest)
+ ) {
+ const before = samplesBefore(rest, deadline);
+ if (before.length > 0) {
+ this.deliverMoved(before);
+ }
+ this.advanceTime(deadline);
+ rest = samplesFrom(rest, deadline);
+ }
+ if (rest.length > 0) {
+ this.deliverMoved(rest);
+ }
+ }
+
+ private deliverMoved(inputs: ReadonlyArray): void {
this.run(inputs[0].time, () => {
const changed = this.update(inputs, 'moved');
if (changed.length === 0) {
@@ -383,6 +464,10 @@ export class GestureArena {
if (inputs.length === 0) {
return dispositions;
}
+ this.noteArrival(
+ inputs[0].time,
+ inputs.some(input => this.isFingerOrPenContact(input.id)),
+ );
this.run(inputs[0].time, () => {
const changed = this.update(inputs, 'ended');
const context = this.context();
@@ -407,6 +492,10 @@ export class GestureArena {
/** The system took these contacts (`touchcancel`, a mouse `pointercancel`). */
cancelled(ids: ReadonlyArray, time: number): void {
+ this.noteArrival(
+ time,
+ ids.some(id => this.isFingerOrPenContact(id)),
+ );
this.run(time, () => {
const touches = this.liveTouches(ids);
for (const touch of touches) {
@@ -437,6 +526,10 @@ export class GestureArena {
* browser took stays the browser's (FR14).
*/
browserTookOver(ids: ReadonlyArray, time: number): void {
+ this.noteArrival(
+ time,
+ ids.some(id => this.isFingerOrPenContact(id)),
+ );
this.run(time, () => {
const touches = this.liveTouches(ids).filter(
touch => !touch.takenByBrowser,
@@ -553,7 +646,7 @@ export class GestureArena {
/** Cancel an active recognizer, or fail a possible one. */
stop(recognizer: GestureRecognizer): void {
// A cancel from code between events happens at the last event's time:
- // wall time would run deadlines ahead of input still queued (FR16).
+ // wall time would run deadlines ahead of input still queued.
const time =
this.currentTime ??
(Number.isFinite(this.latestTime) ? this.latestTime : this.clock.now());
@@ -993,6 +1086,10 @@ export class GestureArena {
touch.x = input.x;
touch.y = input.y;
touch.time = time;
+ touch.inputSamples = [
+ ...(input.history ?? []),
+ {x: input.x, y: input.y, time: input.time},
+ ];
touch.phase = phase;
changed.push(touch);
}
@@ -1005,6 +1102,62 @@ export class GestureArena {
return clamped;
}
+ /** Only a finger's or pen's late input keeps a late deadline waiting. */
+ private noteArrival(time: number, isFingerOrPenInput: boolean): void {
+ const arrivedAt = this.clock.now();
+ if (isFingerOrPenInput && arrivedAt - time > LATE_INPUT_MS) {
+ this.lateInput = {time, arrivedAt};
+ }
+ }
+
+ private isFingerOrPenContact(id: number): boolean {
+ return isFingerOrPen(this.records.get(id)?.touch.pointerType);
+ }
+
+ /**
+ * The earliest timer deadline among the new samples of `inputs`: after the
+ * earliest of them, and at or before the latest. Null when none falls there.
+ */
+ private deadlineAmong(inputs: ReadonlyArray): number | null {
+ let earliest = Number.POSITIVE_INFINITY;
+ let latest = Number.NEGATIVE_INFINITY;
+ for (const input of inputs) {
+ const known =
+ this.records.get(input.id)?.touch.time ?? Number.NEGATIVE_INFINITY;
+ for (const sample of input.history ?? []) {
+ if (sample.time > known) {
+ earliest = Math.min(earliest, sample.time);
+ }
+ }
+ earliest = Math.min(earliest, input.time);
+ latest = Math.max(latest, input.time);
+ }
+ let found: number | null = null;
+ for (const timer of this.timers.values()) {
+ if (
+ timer.deadline > earliest &&
+ timer.deadline <= latest &&
+ (found == null || timer.deadline < found)
+ ) {
+ found = timer.deadline;
+ }
+ }
+ return found;
+ }
+
+ /**
+ * Whether input from before `deadline` reached the page late within the
+ * last `LATE_INPUT_WAIT_MS`, so more of it may still be queued.
+ */
+ private hasLateInputBefore(deadline: number, now: number): boolean {
+ const input = this.lateInput;
+ return (
+ input != null &&
+ input.time < deadline &&
+ now - input.arrivedAt < LATE_INPUT_WAIT_MS
+ );
+ }
+
/**
* One external entry: run the timers due by `time`, then `body`, then
* settle (release held deliveries, reset finished recognizers, forget
@@ -1138,25 +1291,99 @@ export class GestureArena {
return;
}
const delay = Math.max(0, earliest - this.clock.now());
- const fire = (mayYield: boolean): void => {
+ const fire = (
+ after: 'deadline' | 'yield' | 'wait',
+ dueAt: number,
+ ): void => {
this.realTimer = null;
this.realTimerDeadline = Number.POSITIVE_INFINITY;
- if (mayYield && this.clock.now() > earliest) {
+ const now = this.clock.now();
+ // A deadline that came due during a quiet wait is late only past it.
+ const lateBy = now - Math.max(dueAt, this.quietSince);
+ // Only the deadline's own timer counts as late. Only input from before
+ // the deadline extends a wait, so a wait ends.
+ const isLateTimer = after === 'deadline' && lateBy > LATE_TIMER_MS;
+ if (
+ this.isLatestContactFingerOrPen &&
+ after !== 'yield' &&
+ (isLateTimer || this.hasLateInputBefore(earliest, now))
+ ) {
+ // Behind a blocked page, input from before the deadline can still be
+ // queued. A touch move can also reach the page a frame after other
+ // input. Wait while that input still comes. An input stamped at or
+ // past the deadline runs the deadline first, which ends the wait.
+ this.realTimerDeadline = earliest;
+ const waitUntil = now + LATE_INPUT_WAIT_MS;
+ this.realTimer = this.clock.setTimeout(
+ () => fire('wait', waitUntil),
+ LATE_INPUT_WAIT_MS,
+ );
+ return;
+ }
+ if (after === 'wait') {
+ this.quietSince = now;
+ }
+ if (after === 'deadline' && now > earliest) {
// Late: a long task held the main thread past the deadline, and
// input queued behind it may come before the deadline (a lift that
// fails a long press). Let that input dispatch first, once.
this.realTimerDeadline = earliest;
- this.realTimer = this.clock.setTimeout(() => fire(false), 0);
+ this.realTimer = this.clock.setTimeout(() => fire('yield', now), 0);
return;
}
// The event clock moves to the deadline only, so input still queued
// keeps its own timestamps.
this.advanceTime(earliest);
};
- this.realTimer = this.clock.setTimeout(() => fire(true), delay);
+ this.realTimer = this.clock.setTimeout(
+ () => fire('deadline', earliest),
+ delay,
+ );
}
}
+function isFingerOrPen(pointerType: PointerKind | undefined): boolean {
+ return pointerType === 'touch' || pointerType === 'pen';
+}
+
+/** Each input cut to its samples stamped before `time`; inputs with none go. */
+function samplesBefore(
+ inputs: ReadonlyArray,
+ time: number,
+): TouchInput[] {
+ const cut: TouchInput[] = [];
+ for (const input of inputs) {
+ const samples = [
+ ...(input.history ?? []),
+ {x: input.x, y: input.y, time: input.time},
+ ].filter(sample => sample.time < time);
+ const last = samples[samples.length - 1];
+ if (last != null) {
+ cut.push({
+ id: input.id,
+ x: last.x,
+ y: last.y,
+ time: last.time,
+ history: samples.slice(0, -1),
+ });
+ }
+ }
+ return cut;
+}
+
+/** Each input cut to its samples stamped at or after `time`; inputs with none go. */
+function samplesFrom(
+ inputs: ReadonlyArray,
+ time: number,
+): TouchInput[] {
+ return inputs
+ .filter(input => input.time >= time)
+ .map(input => ({
+ ...input,
+ history: (input.history ?? []).filter(sample => sample.time >= time),
+ }));
+}
+
function sharesTouches(a: GestureRecognizer, b: GestureRecognizer): boolean {
for (const id of internals(a).seenTouchIds) {
if (internals(b).seenTouchIds.has(id)) {
diff --git a/packages/core/src/gestures/GestureHost.ts b/packages/core/src/gestures/GestureHost.ts
index 0b64ea12a9581..92b2d4f8262e3 100644
--- a/packages/core/src/gestures/GestureHost.ts
+++ b/packages/core/src/gestures/GestureHost.ts
@@ -3077,17 +3077,51 @@ export class GestureHost {
}
private readonly onTouchStart = (event: TouchEvent): void => {
- this.endWheel(eventTime(event, this.timing));
- this.noteFingersDown(event);
+ this.beginTouches(event, eventTime(event, this.timing));
+ };
+
+ /**
+ * Begins, now, the fingers of a `touchstart` this host did not track. A
+ * recognizer that attaches while a finger is down on its element hands
+ * over that finger's own touchstart. The caller passes only a touchstart
+ * whose fingers are still down. A finger the host heard but left untracked
+ * begins too; a finger it tracks stays as it is. `pointerId` is the
+ * finger's own pointer, whose `pointerdown` came before the host listened.
+ */
+ beginLateTouches(event: TouchEvent, pointerId: number | null = null): void {
+ const [first] = touchesOf(event.changedTouches);
+ if (pointerId != null && first != null) {
+ // The finger's touchstart pairs with this pointer as it begins.
+ this.pendingPointers.set(pointerId, {
+ x: first.clientX,
+ y: first.clientY,
+ target: isNode(first.target)
+ ? landedOn(event, first.target)
+ : landedOn(event),
+ });
+ }
+ this.beginTouches(event, this.arena.pageTime(), true);
+ if (pointerId != null) {
+ // A finger that did not begin leaves no pointer waiting for it.
+ this.pendingPointers.delete(pointerId);
+ }
+ }
+
+ private beginTouches(event: TouchEvent, time: number, isLate = false): void {
+ // A late touchstart the host heard is old news: its fingers are noted.
+ const isHeard = this.processed.has(event);
+ this.endWheel(time);
+ if (!isLate || !isHeard) {
+ this.noteFingersDown(event);
+ }
// Where the host reads a finger from its pointer events (no ontouchstart,
// as after touch emulation turns on), its Touch Events would track it twice.
- if (!this.usesTouchEvents || !this.takeEvent(event)) {
+ if (!this.usesTouchEvents || (!this.takeEvent(event) && !isLate)) {
return;
}
if (this.fingerTargets.length > 1) {
this.failUnclaimedLoneFingerPans();
}
- const time = eventTime(event, this.timing);
const inputs: ArenaBeganInput[] = [];
const untracked: TouchBeganInput[] = [];
const stale: number[] = [];
@@ -3101,6 +3135,10 @@ export class GestureHost {
if ((touch as StylusTouch).touchType === 'stylus') {
continue;
}
+ if (isLate && this.touchIds.has(touch.identifier)) {
+ // Already tracked: the touchstart began it when the host heard it.
+ continue;
+ }
// A finger number still tracked here began again: the touch it named
// ended where no listener of ours could hear it.
this.cancelledFingers.delete(touch.identifier);
@@ -3198,7 +3236,7 @@ export class GestureHost {
if (isNode(landed)) {
this.lastTouch = {target: landed, time};
}
- };
+ }
private readonly onTouchMove = (event: TouchEvent): void => {
this.noteFingersDown(event);
diff --git a/packages/core/src/gestures/__tests__/GestureHost.test.ts b/packages/core/src/gestures/__tests__/GestureHost.test.ts
index 210a57c394683..d631785b3d3e9 100644
--- a/packages/core/src/gestures/__tests__/GestureHost.test.ts
+++ b/packages/core/src/gestures/__tests__/GestureHost.test.ts
@@ -4588,6 +4588,101 @@ describe('GestureHost.fingersDown', () => {
});
});
+describe('a late begin: a finger that landed before its recognizer attached', () => {
+ it('begins the finger from its own touchstart at the host’s time now, so a hold counts from then', () => {
+ const {handle} = mount('');
+ const press = new LongPressGestureRecognizer({minimumPressDuration: 500});
+ const states: string[] = [];
+ press.addListener(recognizer => states.push(recognizer.state));
+ const finger = {id: 1, x: 10, y: 10, target: handle};
+ // Nothing on the page listens as the finger lands.
+ const landed = touch('touchstart', handle, [finger], [finger], 0);
+ clock.time = 300;
+ detachers.push(host.attach(handle, press));
+ host.beginLateTouches(landed as TouchEvent);
+ expect(press.numberOfTouches).toBe(1);
+ clock.runDue(799);
+ expect(states).not.toContain('began');
+ clock.runDue(800);
+ expect(states).toContain('began');
+ touch('touchend', handle, [finger], [], 900);
+ expect(press.numberOfTouches).toBe(0);
+ });
+
+ it('follows the late finger’s moves: a drift past the press’s limit fails it', () => {
+ const {handle} = mount('');
+ const press = new LongPressGestureRecognizer({minimumPressDuration: 500});
+ const states: string[] = [];
+ press.addListener(recognizer => states.push(recognizer.state));
+ const finger = {id: 1, x: 10, y: 10, target: handle};
+ const landed = touch('touchstart', handle, [finger], [finger], 0);
+ clock.time = 300;
+ detachers.push(host.attach(handle, press));
+ host.beginLateTouches(landed as TouchEvent);
+ const moved = {...finger, x: 60};
+ touch('touchmove', handle, [moved], [moved], 350);
+ clock.runDue(1000);
+ expect(states).not.toContain('began');
+ touch('touchend', handle, [moved], [], 1000);
+ });
+
+ it('begins nothing again from a touchstart it already heard', () => {
+ const {handle} = mount('');
+ const press = new LongPressGestureRecognizer({minimumPressDuration: 500});
+ const states: string[] = [];
+ press.addListener(recognizer => states.push(recognizer.state));
+ detachers.push(host.attach(handle, press));
+ const finger = {id: 1, x: 10, y: 10, target: handle};
+ const landed = touch('touchstart', handle, [finger], [finger], 0);
+ clock.time = 300;
+ host.beginLateTouches(landed as TouchEvent);
+ expect(press.numberOfTouches).toBe(1);
+ // The hold still counts from the touchstart the host heard.
+ clock.runDue(500);
+ expect(states).toContain('began');
+ touch('touchend', handle, [finger], [], 600);
+ });
+
+ it('begins a finger it heard but left untracked, as when another gesture keeps it listening', () => {
+ const {handle, other} = mount(
+ '',
+ );
+ // A gesture elsewhere keeps the host listening on the page.
+ detachers.push(
+ host.attach(other, new LongPressGestureRecognizer({name: 'other'})),
+ );
+ const press = new LongPressGestureRecognizer({minimumPressDuration: 500});
+ const states: string[] = [];
+ press.addListener(recognizer => states.push(recognizer.state));
+ const finger = {id: 1, x: 10, y: 10, target: handle};
+ // The host hears this touchstart, but nothing on the handle takes it.
+ const landed = touch('touchstart', handle, [finger], [finger], 0);
+ clock.time = 300;
+ detachers.push(host.attach(handle, press));
+ host.beginLateTouches(landed as TouchEvent);
+ expect(press.numberOfTouches).toBe(1);
+ clock.runDue(799);
+ expect(states).not.toContain('began');
+ clock.runDue(800);
+ expect(states).toContain('began');
+ touch('touchend', handle, [finger], [], 900);
+ });
+
+ it('pairs a late finger with the pointer its caller hands over', () => {
+ const {handle} = mount('');
+ const press = new LongPressGestureRecognizer({minimumPressDuration: 500});
+ const finger = {id: 1, x: 10, y: 10, target: handle};
+ // The finger's pointerdown and touchstart came before any listener.
+ const landed = touch('touchstart', handle, [finger], [finger], 0);
+ clock.time = 300;
+ detachers.push(host.attach(handle, press));
+ host.beginLateTouches(landed as TouchEvent, 31);
+ const [held] = press.trackedTouches;
+ expect(host.pointerIdOf(held)).toBe(31);
+ touch('touchend', handle, [finger], [], 900);
+ });
+});
+
describe('where the primary pointer is fine (spec:AST-094 FR43, FR24)', () => {
/** Quiets the development warning, and returns its spy. */
function quietWarning() {
diff --git a/packages/core/src/gestures/__tests__/arena.test.ts b/packages/core/src/gestures/__tests__/arena.test.ts
index d5a724e20862d..3cdd78433a929 100644
--- a/packages/core/src/gestures/__tests__/arena.test.ts
+++ b/packages/core/src/gestures/__tests__/arena.test.ts
@@ -10,7 +10,9 @@
* requirements, idle recognizers), shouldBegin and shouldReceiveTouch,
* innermost resolution, independent touches, delivery to the view (claims,
* cancelsTouchesInView, delaysTouchesBegan, deferred and replayed clicks,
- * the browser taking a touch), cancellation, and the event clock
+ * the browser taking a touch), cancellation, and the event clock, which
+ * holds a late input at its time and keeps the times the input and its
+ * coalesced samples came with
* @position Unit tests of packages/core/src/gestures/GestureArena.ts and the
* state machine of GestureRecognizer.ts
*/
@@ -402,6 +404,47 @@ describe('arena: cancellation and time', () => {
h.finger(1).move(5, 0, 90);
expect(h.log).toEqual(['r:began@100']);
});
+ it('holds a late input at the clock, and keeps the time it came with', () => {
+ const h = createHarness();
+ const seen: {time: number; cameAt: number | undefined}[] = [];
+ const r = new Scripted('r', {
+ moved: recognizer => {
+ const [touch] = recognizer.trackedTouches;
+ seen.push({time: touch.time, cameAt: touch.inputSamples.at(-1)?.time});
+ },
+ });
+ h.finger(1).down(0, 0, 100, {recognizers: [r]});
+ h.advance(500);
+ h.finger(1).move(5, 0, 300);
+ h.finger(1).move(6, 0, 520);
+ expect(seen).toEqual([
+ {time: 500, cameAt: 300},
+ {time: 520, cameAt: 520},
+ ]);
+ });
+ it('keeps a late move’s coalesced samples at the times they came with', () => {
+ const h = createHarness();
+ const seen: {samples: number[]; inputSamples: number[]}[] = [];
+ const r = new Scripted('r', {
+ moved: recognizer => {
+ const [touch] = recognizer.trackedTouches;
+ seen.push({
+ samples: touch.samples.map(sample => sample.time),
+ inputSamples: touch.inputSamples.map(sample => sample.time),
+ });
+ },
+ });
+ h.finger(1).down(0, 0, 100, {recognizers: [r]});
+ h.advance(500);
+ h.finger(1).move(5, 0, 300);
+ // Both late: the clock holds them at 500 ms, and `samples` drops the
+ // earlier one, which comes before the touch's held time.
+ h.finger(1).move(7, 0, 320, [{x: 6, y: 0, time: 310}]);
+ expect(seen).toEqual([
+ {samples: [500], inputSamples: [300]},
+ {samples: [500], inputSamples: [310, 320]},
+ ]);
+ });
});
/** A clock whose timers run one task at a time, as an event loop does. */
@@ -472,12 +515,14 @@ describe('arena: a timer that fires late', () => {
expect(log.some(entry => entry.startsWith('press:began'))).toBe(false);
});
- it('still fires on its deadline when nothing was queued', () => {
+ it('still fires on its deadline when nothing was queued, once the wait for queued input ends', () => {
const {clock, arena, log} = pressArena();
clock.runTask(800);
clock.runTask(800);
+ expect(log.some(entry => entry.startsWith('press:began'))).toBe(false);
+ clock.runTask(850);
expect(log).toContain('press:began@500');
- arena.ended([{id: 1, x: 0, y: 0, time: 820}]);
+ arena.ended([{id: 1, x: 0, y: 0, time: 870}]);
});
});
diff --git a/packages/core/src/gestures/__tests__/arenaTimersAndClaims.test.ts b/packages/core/src/gestures/__tests__/arenaTimersAndClaims.test.ts
index e2aaeaa925a0f..b29533971589c 100644
--- a/packages/core/src/gestures/__tests__/arenaTimersAndClaims.test.ts
+++ b/packages/core/src/gestures/__tests__/arenaTimersAndClaims.test.ts
@@ -13,6 +13,7 @@ import {GestureArena, type GestureClock} from '../GestureArena';
import {LongPressGestureRecognizer} from '../LongPressGestureRecognizer';
import {PanGestureRecognizer} from '../PanGestureRecognizer';
import {TapGestureRecognizer} from '../TapGestureRecognizer';
+import type {PointerKind} from '../types';
import {createHarness} from './harness';
/** A clock whose timers run one task at a time, as an event loop does. */
@@ -44,7 +45,7 @@ class TaskClock implements GestureClock {
}
}
-function pressArena(): {
+function pressArena(pointerType: PointerKind = 'touch'): {
clock: TaskClock;
arena: GestureArena;
press: LongPressGestureRecognizer;
@@ -64,7 +65,7 @@ function pressArena(): {
x: 0,
y: 0,
time: 0,
- pointerType: 'touch',
+ pointerType,
target: null,
scroll: null,
recognizers: [press],
@@ -96,13 +97,162 @@ describe('a timer that fires late', () => {
arena.ended([{id: 1, x: 40, y: 0, time: 820}]);
});
- it('still fires on its deadline when nothing was queued', () => {
+ it('still fires on its deadline when nothing was queued, once the wait for queued input ends', () => {
const {clock, arena, log} = pressArena();
+ // 300 ms late: the deadline waits 50 ms for input still queued.
clock.runTask(800);
clock.runTask(800);
+ expect(log.some(entry => entry.startsWith('press:began'))).toBe(false);
+ clock.runTask(850);
+ expect(log).toContain('press:began@500');
+ arena.ended([{id: 1, x: 0, y: 0, time: 870}]);
+ });
+
+ it('waits more than one task for input queued behind the block: a drift that comes after the next task still fails the press', () => {
+ const {clock, arena, log} = pressArena();
+ // The timer task runs at 800, and so does the next task. The finger's
+ // drift from 300 ms reaches the page at 816, as Chromium sends touch
+ // moves with the next frame.
+ clock.runTask(800);
+ clock.runTask(800);
+ clock.time = 816;
+ arena.moved([{id: 1, x: 40, y: 0, time: 300}]);
+ clock.runTask(850);
+ expect(log.some(entry => entry.startsWith('press:began'))).toBe(false);
+ expect(log).toContain('press:failed@300');
+ arena.ended([{id: 1, x: 40, y: 0, time: 870}]);
+ });
+
+ it('keeps an on-time deadline waiting while input from before it still comes late', () => {
+ const {clock, arena, log} = pressArena();
+ // A move from 400 ms reaches the page at 470, 70 ms late, inside the
+ // press's tolerance. The deadline at 500 waits 50 ms past that move.
+ clock.time = 470;
+ arena.moved([{id: 1, x: 2, y: 0, time: 400}]);
+ clock.runTask(500);
+ expect(log.some(entry => entry.startsWith('press:began'))).toBe(false);
+ clock.runTask(550);
+ expect(log).toContain('press:began@500');
+ arena.ended([{id: 1, x: 2, y: 0, time: 570}]);
+ });
+
+ it('ends the wait at the first input stamped at or past the deadline', () => {
+ const {clock, arena, log} = pressArena();
+ clock.runTask(800);
+ clock.time = 820;
+ arena.moved([{id: 1, x: 1, y: 0, time: 820}]);
+ expect(log).toContain('press:began@500');
+ arena.ended([{id: 1, x: 1, y: 0, time: 840}]);
+ });
+
+ it('ends the wait when its own timer runs late with nothing queued, with no second wait', () => {
+ const {clock, arena, log} = pressArena();
+ // The deadline's timer runs late: it waits until 850.
+ clock.runTask(800);
+ // That wait's own timer runs 50 ms late behind another block. No input
+ // from before the deadline came late, so the deadline runs now.
+ clock.runTask(900);
+ expect(log).toContain('press:began@500');
+ arena.ended([{id: 1, x: 0, y: 0, time: 920}]);
+ });
+
+ it('keeps the one-task yield for a mouse: its late deadline runs after the next task, with no wait', () => {
+ const {clock, arena, log} = pressArena('mouse');
+ clock.runTask(800);
+ expect(log.some(entry => entry.startsWith('press:began'))).toBe(false);
+ clock.runTask(800);
expect(log).toContain('press:began@500');
arena.ended([{id: 1, x: 0, y: 0, time: 820}]);
});
+
+ it('waits for a pen’s late deadline as for a finger’s', () => {
+ const {clock, arena, log} = pressArena('pen');
+ clock.runTask(800);
+ clock.runTask(800);
+ expect(log.some(entry => entry.startsWith('press:began'))).toBe(false);
+ clock.runTask(850);
+ expect(log).toContain('press:began@500');
+ arena.ended([{id: 1, x: 0, y: 0, time: 870}]);
+ });
+
+ it('runs a deadline that came due during a wait just after it, with no second wait', () => {
+ const clock = new TaskClock();
+ const log: string[] = [];
+ const arena: GestureArena = new GestureArena({
+ clock,
+ onTransition: (recognizer, _from, to) =>
+ log.push(`${recognizer.name}:${to}@${arena.now()}`),
+ });
+ const first = new LongPressGestureRecognizer({
+ name: 'first',
+ minimumPressDuration: 500,
+ });
+ const second = new LongPressGestureRecognizer({
+ name: 'second',
+ minimumPressDuration: 600,
+ });
+ arena.began([
+ {
+ id: 1,
+ x: 0,
+ y: 0,
+ time: 0,
+ pointerType: 'touch',
+ target: null,
+ scroll: null,
+ recognizers: [first],
+ consumer: null,
+ },
+ {
+ id: 2,
+ x: 100,
+ y: 0,
+ time: 0,
+ pointerType: 'touch',
+ target: null,
+ scroll: null,
+ recognizers: [second],
+ consumer: null,
+ },
+ ]);
+ // Both deadlines ran late behind one block. The first waits 50 ms; the
+ // second comes due during that wait, so it runs as the wait ends.
+ clock.runTask(900);
+ clock.runTask(950);
+ clock.runTask(950);
+ clock.runTask(950);
+ expect(log).toContain('first:began@500');
+ expect(log).toContain('second:began@600');
+ arena.ended([
+ {id: 1, x: 0, y: 0, time: 970},
+ {id: 2, x: 100, y: 0, time: 970},
+ ]);
+ });
+});
+
+describe('a coalesced move whose samples straddle a deadline', () => {
+ it('delivers the samples stamped before the deadline first: a drift among them fails the press', () => {
+ const {clock, arena, log} = pressArena();
+ // One move reaches the page at 520 with the sample it coalesced: the
+ // finger drifted 40 px at 480, before the press's deadline at 500.
+ clock.time = 520;
+ arena.moved([
+ {id: 1, x: 40, y: 0, time: 520, history: [{x: 40, y: 0, time: 480}]},
+ ]);
+ expect(log.some(entry => entry.startsWith('press:began'))).toBe(false);
+ expect(log).toContain('press:failed@480');
+ arena.ended([{id: 1, x: 40, y: 0, time: 540}]);
+ });
+
+ it('runs the deadline before the samples stamped at or after it', () => {
+ const {clock, arena, log} = pressArena();
+ clock.time = 520;
+ arena.moved([
+ {id: 1, x: 1, y: 0, time: 520, history: [{x: 1, y: 0, time: 480}]},
+ ]);
+ expect(log).toContain('press:began@500');
+ arena.ended([{id: 1, x: 1, y: 0, time: 540}]);
+ });
});
describe('cancelling an idle recognizer', () => {
diff --git a/packages/core/src/gestures/__tests__/harness.ts b/packages/core/src/gestures/__tests__/harness.ts
index 37f8796de614d..3e7fecf58ff86 100644
--- a/packages/core/src/gestures/__tests__/harness.ts
+++ b/packages/core/src/gestures/__tests__/harness.ts
@@ -5,8 +5,8 @@
* @input Nothing
* @output Exports the synthetic-input harness the gesture tests share: a
* manual clock, an arena wired to a transition log, fingers that land,
- * move and lift at explicit timestamps, and a coarse primary pointer for
- * tests that go through the document's host
+ * move (with coalesced samples) and lift at explicit timestamps, and a
+ * coarse primary pointer for tests that go through the document's host
* @position Test-only helper of packages/core/src/gestures (excluded from the
* build with the rest of __tests__)
*/
@@ -18,6 +18,7 @@ import type {
GestureTouch,
NativeScrollProbe,
TouchConsumer,
+ TouchSample,
} from '../types';
/**
@@ -82,8 +83,11 @@ export interface Harness {
view?: {left?: number; top?: number; width: number; height: number};
};
finger(id: number): Finger;
- /** Advance the clock and run every timer due by `time`. */
- advance(time: number): void;
+ /**
+ * Advance the clock and run every timer due by `time`. `runsAt`: when the
+ * page runs those timers on the clock, later behind a block.
+ */
+ advance(time: number, runsAt?: number): void;
}
export function createHarness(): Harness {
@@ -138,8 +142,8 @@ export function createHarness(): Harness {
}
return finger;
},
- advance: time => {
- clock.time = time;
+ advance: (time, runsAt = time) => {
+ clock.time = runsAt;
arena.advanceTime(time);
},
};
@@ -189,12 +193,25 @@ export class Finger {
return this;
}
- move(x: number, y: number, time: number): this {
+ /**
+ * `history`: the coalesced samples before this one, oldest first.
+ * `arrivesAt`: when the page gets the move on the clock, for a move that
+ * reaches it after its own time.
+ */
+ move(
+ x: number,
+ y: number,
+ time: number,
+ history?: ReadonlyArray,
+ arrivesAt = time,
+ ): this {
this.x = x;
this.y = y;
this.time = time;
- this.harness.clock.time = time;
- this.harness.arena.moved([{id: this.id, x, y, time}]);
+ this.harness.clock.time = arrivesAt;
+ this.harness.arena.moved([
+ {id: this.id, x, y, time, ...(history == null ? {} : {history})},
+ ]);
return this;
}
diff --git a/packages/core/src/gestures/types.ts b/packages/core/src/gestures/types.ts
index ef646cecde9d2..f070a777e1058 100644
--- a/packages/core/src/gestures/types.ts
+++ b/packages/core/src/gestures/types.ts
@@ -81,6 +81,13 @@ export interface GestureTouch {
y: number;
/** Timestamp of the latest position. */
time: number;
+ /**
+ * 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 the
+ * arena holds a late input's `time` and filters `samples`. The arena leaves
+ * these positions as they came.
+ */
+ inputSamples: TouchSample[];
readonly startX: number;
readonly startY: number;
readonly startTime: number;
diff --git a/packages/core/src/hooks/__tests__/MenuPressShadowRoot.a11y.chromium.spec.ts b/packages/core/src/hooks/__tests__/MenuPressShadowRoot.a11y.chromium.spec.ts
index f1ba9e34cb3e3..00b7369715bc5 100644
--- a/packages/core/src/hooks/__tests__/MenuPressShadowRoot.a11y.chromium.spec.ts
+++ b/packages/core/src/hooks/__tests__/MenuPressShadowRoot.a11y.chromium.spec.ts
@@ -8,7 +8,9 @@
* @output Real-engine proof that a menu rendered inside a shadow root acts on
* the row under a released pointer (module:DropdownMenu/useMenuPress FR1),
* and that a ContextMenu there tells a press on its own rows from a press
- * outside it, a mouse's at once and a finger's on its lift.
+ * outside it, a mouse's at once and a finger's on its lift. For the finger,
+ * touch emulation is on from the first paint, and the finger lands once the
+ * touch layer has loaded.
* @position Run with `pnpm test:a11y-contract`. Only a real engine resolves a
* point inside a shadow root to the shadow host at the document level.
*/
@@ -52,6 +54,27 @@ test('a mouse click on an option inside a shadow root selects it', async ({
await expect(page.getByTestId('selected-value')).toHaveText('Banana');
});
+/** The touch layer's own chunk, which loads after the page's first paint. */
+const TOUCH_LAYER_CHUNK = /\/ContextMenuTouchLayer-[\w-]+\.js(?:\?.*)?$/;
+
+/**
+ * Waits for the touch layer: its chunk's response, the module itself, then two
+ * frames for the layer to mount. A finger that lands sooner starts its hold
+ * only at that mount, so the menu opens a full hold after the load.
+ */
+async function waitForTouchLayer(
+ page: Page,
+ chunk: ReturnType,
+): Promise {
+ const url = (await chunk).url();
+ await page.evaluate(async layerUrl => {
+ await import(layerUrl);
+ await new Promise(resolve => {
+ requestAnimationFrame(() => requestAnimationFrame(() => resolve()));
+ });
+ }, url);
+}
+
const CONTEXT_STORY =
'a11y-menu-press-in-a-shadow-root--context-menu-in-shadow-root';
@@ -103,16 +126,21 @@ test('a ContextMenu inside a shadow root picks a clicked item, and a press on it
test('a ContextMenu inside a shadow root stays open as its opening long press lifts, and a tap on its host closes it', async ({
page,
}) => {
- await page.goto(
- `${storybook.origin}/iframe.html?id=${CONTEXT_STORY}&viewMode=story`,
- );
- const {trigger, hostPadding} = await points(page);
- const menu = page.getByRole('menu');
+ // Touch emulation makes the primary pointer coarse from the first paint.
const cdp = await page.context().newCDPSession(page);
await cdp.send('Emulation.setTouchEmulationEnabled', {
enabled: true,
maxTouchPoints: 1,
});
+ const touchLayer = page.waitForResponse(response =>
+ TOUCH_LAYER_CHUNK.test(response.url()),
+ );
+ await page.goto(
+ `${storybook.origin}/iframe.html?id=${CONTEXT_STORY}&viewMode=story`,
+ );
+ await waitForTouchLayer(page, touchLayer);
+ const {trigger, hostPadding} = await points(page);
+ const menu = page.getByRole('menu');
await cdp.send('Input.dispatchTouchEvent', {
type: 'touchStart',
diff --git a/packages/core/src/hooks/usePager.test.ts b/packages/core/src/hooks/usePager.test.ts
index ab575e93ef0b9..97cbdc7b84229 100644
--- a/packages/core/src/hooks/usePager.test.ts
+++ b/packages/core/src/hooks/usePager.test.ts
@@ -903,7 +903,10 @@ describe('createPager', () => {
// Still moving 40 ms after the touch.
expect(f.pager.isSettling).toBe(true);
await advance(paging.catchStopMs, f.clock);
- // The catch's deadline is on the gesture clock.
+ // The catch's deadline is on the gesture clock. It ran late, so it waits
+ // 50 ms for input still queued before it.
+ f.clock.runDue(now);
+ await advance(50, f.clock);
f.clock.runDue(now);
expect(f.pager.isSettling).toBe(false);
const held = -f.x();
@@ -2054,6 +2057,9 @@ describe('createPager', () => {
expect(pager.isSettling).toBe(true);
resize(300);
await advance(paging.catchStopMs, f.clock);
+ // The catch's deadline ran late: it waits 50 ms for queued input.
+ f.clock.runDue(now);
+ await advance(50, f.clock);
f.clock.runDue(now);
expect(pager.isSettling).toBe(false);
const held = -f.x();
diff --git a/packages/core/src/motion/README.md b/packages/core/src/motion/README.md
index 25b4b8d048010..24b6c7c36c63f 100644
--- a/packages/core/src/motion/README.md
+++ b/packages/core/src/motion/README.md
@@ -18,6 +18,7 @@ roles through `resolveMotion`.
| `uikit/springs.ts` | Interaction springs (navigation, sheets, alerts, menus, controls, keyboard, banners) and the SwiftUI / UIKit presets. |
| `uikit/scroll.ts` | UIScrollView: deceleration rates, rubber band, bounce-back spring, `delaysContentTouches`, scroll to top. |
| `uikit/timing.ts` | Non-spring clocks and curves: press highlight, Core Animation's named curves, keyboard, Reduced Motion cross-fade. |
+| `uikit/contextMenu.ts` | UIContextMenuInteraction: touch timeline (feedback, commit, menu), drift tolerance, the press feedback's held scale, commit haptic. |
| `uikit/paging.ts` | A paging UIScrollView: the integrator that settles a release on its page, the page rule, the catch, `setContentOffset(animated:)`. |
| `uikit/alert.ts` | UIAlertController: how a finger is tracked across the actions (highlight onset and bounds). |
| `uikit/navigation.ts` | UINavigationController: push velocity, parallax, dimming, transition clock, interactive pop finish rule. |
diff --git a/packages/core/src/motion/uikit/contextMenu.ts b/packages/core/src/motion/uikit/contextMenu.ts
new file mode 100644
index 0000000000000..7d7743e20b664
--- /dev/null
+++ b/packages/core/src/motion/uikit/contextMenu.ts
@@ -0,0 +1,117 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+/**
+ * @file contextMenu.ts
+ * @input Measurements of UIContextMenuInteraction on iOS 26.2
+ * @output `contextMenu`: UIContextMenuInteraction's touch timeline, drift
+ * tolerance, held scale and commit haptic
+ * @position The context-menu domain of the UIKit constants table. Only
+ * ContextMenu's own modules import it. The table's barrel does not
+ * re-export it.
+ *
+ * SYNC: When modified, update /packages/core/src/motion/MEASUREMENTS.md,
+ * /packages/core/src/ContextMenu/contextMenuPressFeedback.ts and
+ * /packages/core/src/ContextMenu/contextMenuPress.ts
+ */
+
+/**
+ * UIContextMenuInteraction's touch timeline on iOS 26.2. A context menu is not
+ * a plain long press. A finger that rests on the view starts a press feedback
+ * after 150 ms. A copy of the view grows uniformly, and its size follows a
+ * linear ramp through a spring. At 400 ms the press commits. The click haptic
+ * plays, and the touch can no longer become a tap. The menu displays at 735 ms
+ * if the finger is still down, or at the lift after the commit. A finger that
+ * lifts before the commit gets no menu, and the copy springs back. A finger
+ * that drifts too far before the menu displays gets the same.
+ *
+ * UIKit runs this on display-link ticks. So a 60 Hz screen shows each moment
+ * on the first frame after it: the feedback at 151 ms, the commit at 417 ms.
+ * The times here are the moments themselves, from the `touchstart` timestamp.
+ * UIKit counts from the main thread's receipt of the touch, about a frame
+ * after the hardware timestamp that a browser stamps. A browser's compositor
+ * shows a value about a frame after its time, so the two offsets cancel.
+ * Scales are fractions of the view's own size. The lift and dismissal springs
+ * are `springs.contextMenuLift` and `springs.contextMenuDismiss`.
+ *
+ * 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 = {
+ press: {
+ /**
+ * When the long press commits. The click haptic plays, and from then on
+ * the touch belongs to the menu, not to a tap. The menu itself waits for
+ * `menuDisplayMs` or the lift.
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
+ * iPhone 17 Pro, recognizer state log, Oct 23 2026: the
+ * clickPresentationExclusion and clickPresentationFailure recognizers
+ * ended on the first 60 Hz tick after 400 ms (at 416.7 ms; the tick
+ * before, at 399.5 ms, had not), the haptic played at 420 ms, and the
+ * platter's size ramp changes slope at 400 ms
+ * @measure M-CM6
+ */
+ commitMs: 400,
+ /**
+ * How far the finger may drift on either axis, from where it landed,
+ * until the menu displays; past it the press ends with no menu. Not the
+ * long press's `UIKIT_GESTURES.longPress.allowableMovement` (a distance):
+ * a diagonal drift of 15.6 pt still opens the menu.
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
+ * iPhone 17 Pro, drifts at 100, 250 and 500 ms, Oct 23 2026: (7, 7),
+ * (8, 8), (10, 0) and (11, 11) pt open the menu; (12, 0) and (0, 12)
+ * cancel it, before and after the onset alike, and a 30 pt drag after
+ * the commit cancels it too
+ * @source GUESS — the value, midway in the measured bracket (11, 12)
+ * @measure M-CM3
+ */
+ allowableMovement: 11.5,
+ /**
+ * When the menu displays for a finger that is still down: the delegate's
+ * willDisplay, with the backdrop and the menu. Until then, only the press
+ * copy shows, and it grows on the second ramp. A finger lifted after the
+ * commit gets the menu at the lift.
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
+ * iPhone 17 Pro, delegate log and per-frame view tree, Oct 23 2026:
+ * 735–738 ms after the touch over five warm presses at random display
+ * phase (734 ms on the first press of a session); a press lifted at
+ * 0.5 s displayed at the lift (529 ms)
+ */
+ menuDisplayMs: 735,
+ /**
+ * The size the press copy reaches when the menu displays, as a fraction
+ * of the view. It is the second ramp at `menuDisplayMs`: 1 + 0.1 per
+ * second since the touch. The trigger grows toward it on
+ * `springs.contextMenuLift`, not on UIKit's ramp.
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
+ * iPhone 17 Pro, per-frame model frames of the press platter over a
+ * 200 × 120 pt view, Oct 23 2026: 0.1001 per second, linear over 19
+ * frames, zero at the touch (−1.4 ms), at 735 ms
+ * @measure M-CM2
+ */
+ heldScale: 1.0735,
+ },
+ /**
+ * The click haptic at the commit, as a vibration where that is the only
+ * haptic (Android browsers). UIKit plays a private pattern
+ * (`_UIClickPresentationFeedbackGenerator`) at the commit; iOS Safari can
+ * play nothing at that moment, because no tap lands then.
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
+ * iPhone 17 Pro, UIFeedbackGenerator hook, Oct 23 2026: the click
+ * presentation feedback plays 3 ms after the commit, nothing plays for a
+ * press lifted before it (the moment)
+ * @source GUESS — a medium impact stands in for the private pattern (the
+ * kind)
+ * @measure M-CM5
+ */
+ commitHaptic: 'impactMedium',
+ /**
+ * Reduce Motion: whether the press feedback still grows the view. It does
+ * not; only the copy's shadow fades in, and the haptic and the menu stay.
+ * @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
+ * iPhone 17 Pro, per-frame platter frames with Reduce Motion on, Prefer
+ * Cross-Fade off and on, Oct 23 2026: the platter stays at scale 1 and
+ * opacity 1 through the hold while its shadow opacity rises 0 → 0.31 by
+ * 0.6 s; a press lifted at 0.25 s does not grow either
+ */
+ reducedMotionFeedback: false,
+} as const;
diff --git a/packages/core/src/privateAttributes/contextMenuTrigger.stylex.ts b/packages/core/src/privateAttributes/contextMenuTrigger.stylex.ts
new file mode 100644
index 0000000000000..4ee45bad2ba24
--- /dev/null
+++ b/packages/core/src/privateAttributes/contextMenuTrigger.stylex.ts
@@ -0,0 +1,41 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+/**
+ * @file privateAttributes/contextMenuTrigger.stylex.ts
+ * @input A ContextMenu trigger whose touch press feedback is attached
+ * @output markContextMenuTrigger, which marks the trigger, and
+ * closestContextMenuTrigger, which finds the trigger at or above an element
+ * along the flat tree
+ * @position Owner module of the private context-menu-trigger attribute: the
+ * only file that writes its name. ContextMenu's press feedback
+ * (ContextMenu/contextMenuPressFeedback.ts) marks its trigger and finds the
+ * trigger a press belongs to. No package entry exports it.
+ */
+
+import {parentAcrossShadow} from '../utils/flatTree';
+import {isElement} from '../utils/nodeType';
+
+const CONTEXT_MENU_TRIGGER = 'data-astryx-context-menu-trigger';
+
+/** Marks `trigger` as a ContextMenu trigger. The returned call unmarks it. */
+export function markContextMenuTrigger(trigger: Element): () => void {
+ trigger.setAttribute(CONTEXT_MENU_TRIGGER, '');
+ return () => {
+ trigger.removeAttribute(CONTEXT_MENU_TRIGGER);
+ };
+}
+
+/**
+ * The ContextMenu trigger at or above `element`, or null outside one. The
+ * search follows the flat tree the browser dispatches through: slotted content
+ * goes to its slot, and a shadow root to its host. So a landing inside a
+ * shadow root in the trigger, or on content slotted into it, finds it.
+ */
+export function closestContextMenuTrigger(element: Element): Element | null {
+ for (let at: Node | null = element; at != null; at = parentAcrossShadow(at)) {
+ if (isElement(at) && at.hasAttribute(CONTEXT_MENU_TRIGGER)) {
+ return at;
+ }
+ }
+ return null;
+}
diff --git a/packages/core/src/utils/flatTree.ts b/packages/core/src/utils/flatTree.ts
index 2c1cd26e1aaf3..1c11778bafb55 100644
--- a/packages/core/src/utils/flatTree.ts
+++ b/packages/core/src/utils/flatTree.ts
@@ -8,8 +8,9 @@
* shadowRootsOutward
* @position The flat-tree parent the browser scrolls and dispatches
* through. The gesture host's native-scroll probe, the outside-press watch,
- * the selection lock and the Layer module's input hold share it. The press
- * feedback controller uses the selection lock without the gesture system
+ * the selection lock, the Layer module's input hold and ContextMenu's
+ * trigger lookup share it. The press feedback controller uses the selection
+ * lock without the gesture system
*/
import {isShadowRoot} from './nodeType';
diff --git a/packages/lab/src/PageControl/__tests__/PageControl.interaction.browser.spec.ts b/packages/lab/src/PageControl/__tests__/PageControl.interaction.browser.spec.ts
index d26a154fd709d..a56abf47f7cc3 100644
--- a/packages/lab/src/PageControl/__tests__/PageControl.interaction.browser.spec.ts
+++ b/packages/lab/src/PageControl/__tests__/PageControl.interaction.browser.spec.ts
@@ -40,6 +40,7 @@ import {
withStorybook,
} from '@astryxdesign/interaction-harness';
import {jogInterval} from '../pageControlModel';
+import {holdBegin, type HeldClock, type TimerTask} from './holdBegin';
const storybook = withStorybook(test);
@@ -56,42 +57,8 @@ const DOT_SCALE = 0.967;
const MIN_JUDGED_FRAMES = 4;
/** The one-slot slides the busy proof judges as one pool. */
const BUSY_SLIDES = 3;
-/** UIPageControl's interaction delay, ms. */
-const HOLD_MS = 155;
/** One frame at 60 Hz, ms. */
const FRAME_MS = 1000 / 60;
-/** WebKit's page clocks keep whole milliseconds. */
-const CLOCK_SLOP_MS = 2;
-
-/** A timer the page ran, on the page's clock. */
-interface TimerTask {
- id: number;
- delay: number;
- due: number;
- ranAt: number | null;
- scheduledAt: number;
- /** The timer task that set it, if any. */
- parentId: number | null;
-}
-
-/** What the held-finger proof records on the page, on the page's clock. */
-interface HeldClock {
- /** The landing's pointer and touch event timeStamps. */
- landings: number[];
- /** When the page dispatched the landing, on the same clock. */
- dispatchedAt: number;
- /** The timer task that runs now. */
- task: TimerTask | null;
- timers: TimerTask[];
- frames: number[];
- flip: {
- at: number;
- task: TimerTask | null;
- /** The pointer or touch event being dispatched at the commit, if any. */
- input: {type: string; timeStamp: number} | null;
- fadedAt: number | null;
- } | null;
-}
/**
* Opens a PageControl story. The phone projects have a coarse primary
@@ -565,32 +532,11 @@ test('a held finger shows the platter, the pressed overlay, and dims the other i
if (flip == null) {
throw new Error('The held look never showed.');
}
- // The hold begins where the gesture arena learns its deadline has passed.
- // That is the hold timer's own task, or the one 0 ms task the arena sets
- // after the deadline when that timer ran late. It is also any input dated
- // after the deadline that the page dispatches first. The look commits there.
- const task = flip.task;
- const parent = clock.timers.find(timer => timer.id === task?.parentId);
- // The deadline is 155 ms after the landing, as the gesture arena dates it.
- // The arena's clock never runs back, so a busy page that dispatches the
- // landing late can date it as late as that dispatch.
- const earliest = Math.min(...clock.landings) + HOLD_MS;
- const latest = Math.max(clock.dispatchedAt, ...clock.landings) + HOLD_MS;
- const holdTimer =
- task != null &&
- task.delay === 0 &&
- parent != null &&
- task.scheduledAt >= earliest
- ? parent
- : task;
- const isHoldTimer =
- holdTimer != null &&
- holdTimer.due >= earliest - CLOCK_SLOP_MS &&
- holdTimer.due <= latest + CLOCK_SLOP_MS;
- const isLateInput =
- !isHoldTimer &&
- flip.input != null &&
- flip.input.timeStamp >= earliest - CLOCK_SLOP_MS;
+ const {task, parent, earliest, holdTimer, isLateInput} = holdBegin(
+ clock,
+ flip,
+ );
+ const isHoldTimer = holdTimer != null;
expect(
isHoldTimer || isLateInput,
`the held look commits where the hold begins: landing ${JSON.stringify(clock.landings)}, dispatched at ${clock.dispatchedAt}, commit task ${JSON.stringify(task)}, its parent ${JSON.stringify(parent ?? null)}, input ${JSON.stringify(flip.input)}`,
diff --git a/packages/lab/src/PageControl/__tests__/holdBegin.test.ts b/packages/lab/src/PageControl/__tests__/holdBegin.test.ts
new file mode 100644
index 0000000000000..e536b2d67415e
--- /dev/null
+++ b/packages/lab/src/PageControl/__tests__/holdBegin.test.ts
@@ -0,0 +1,131 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+import {describe, expect, it} from 'vitest';
+import {
+ holdBegin,
+ type HeldClock,
+ type HeldFlip,
+ type TimerTask,
+} from './holdBegin';
+
+/** A timer the page ran or cleared. */
+function timer(
+ id: number,
+ scheduledAt: number,
+ delay: number,
+ ranAt: number | null,
+ parentId: number | null = null,
+): TimerTask {
+ return {id, delay, due: scheduledAt + delay, ranAt, scheduledAt, parentId};
+}
+
+function clockOf(
+ landing: number,
+ dispatchedAt: number,
+ timers: TimerTask[],
+): HeldClock {
+ return {
+ landings: [landing, landing],
+ dispatchedAt,
+ task: null,
+ timers,
+ frames: [],
+ flip: null,
+ };
+}
+
+function flipAt(
+ at: number,
+ task: TimerTask | null,
+ input: HeldFlip['input'] = null,
+): HeldFlip {
+ return {at, task, input, fadedAt: null};
+}
+
+describe('holdBegin', () => {
+ it('finds the deadline timer when the look commits in its own task', () => {
+ const deadline = timer(1, 551, 144, 695);
+ const result = holdBegin(
+ clockOf(540, 551, [deadline]),
+ flipAt(698, deadline),
+ );
+ expect(result.holdTimer).toBe(deadline);
+ expect(result.isLateInput).toBe(false);
+ });
+
+ it('finds the deadline timer when the look commits in the 0 ms yield it sets after running late', () => {
+ const deadline = timer(1, 551, 144, 720);
+ const yieldTask = timer(2, 720, 0, 720.5, 1);
+ const result = holdBegin(
+ clockOf(540, 551, [deadline, yieldTask]),
+ flipAt(721, yieldTask),
+ );
+ expect(result.holdTimer).toBe(deadline);
+ });
+
+ // A Chromium run under load: a move from before the deadline reached the
+ // page late, so the arena waited 50 ms after its on-time deadline.
+ it('finds the deadline timer when the look commits in the 50 ms wait for input still queued', () => {
+ const deadline = timer(1, 875.7, 147.6, 1022.9);
+ const wait = timer(2, 1023, 50, 1073.2, 1);
+ const result = holdBegin(
+ clockOf(868.3, 876.2, [deadline, wait]),
+ flipAt(1073.5, wait),
+ );
+ expect(result.holdTimer).toBe(deadline);
+ });
+
+ // A WebKit run: the wait was pending when a move dated after the deadline
+ // came, and that move ended it.
+ it('finds the deadline timer when an input dated after the deadline ends a pending wait', () => {
+ const deadline = timer(1, 590, 153, 743);
+ const wait = timer(2, 743, 50, null, 1);
+ const result = holdBegin(
+ clockOf(586, 590, [deadline, wait]),
+ flipAt(782, null, {type: 'pointermove', timeStamp: 777}),
+ );
+ expect(result.holdTimer).toBe(deadline);
+ });
+
+ it('finds the deadline timer through a wait that a later late input extended', () => {
+ const deadline = timer(1, 551, 144, 695);
+ const wait = timer(2, 695, 50, 745, 1);
+ const extended = timer(3, 745, 50, 795, 2);
+ const result = holdBegin(
+ clockOf(540, 551, [deadline, wait, extended]),
+ flipAt(796, extended),
+ );
+ expect(result.holdTimer).toBe(deadline);
+ });
+
+ it('takes no input dated before the deadline as the one that ends a pending wait', () => {
+ const deadline = timer(1, 551, 144, 695);
+ const wait = timer(2, 695, 50, null, 1);
+ const result = holdBegin(
+ clockOf(540, 551, [deadline, wait]),
+ flipAt(720, null, {type: 'pointermove', timeStamp: 650}),
+ );
+ expect(result.holdTimer).toBeUndefined();
+ expect(result.isLateInput).toBe(false);
+ });
+
+ it('takes no other 50 ms timer for the hold', () => {
+ const other = timer(1, 600, 50, 650);
+ const result = holdBegin(clockOf(540, 551, [other]), flipAt(651, other));
+ expect(result.holdTimer).toBeUndefined();
+ expect(result.isLateInput).toBe(false);
+ });
+
+ it('keeps a deadline timer that ran late as the hold timer, so the proof judges its own lateness', () => {
+ const deadline = timer(1, 551, 144, 777);
+ const wait = timer(2, 777, 50, 827, 1);
+ const result = holdBegin(
+ clockOf(540, 551, [deadline, wait]),
+ flipAt(828, wait),
+ );
+ expect(result.holdTimer).toBe(deadline);
+ expect((result.holdTimer?.ranAt ?? 0) - (result.holdTimer?.due ?? 0)).toBe(
+ 82,
+ );
+ });
+});
diff --git a/packages/lab/src/PageControl/__tests__/holdBegin.ts b/packages/lab/src/PageControl/__tests__/holdBegin.ts
new file mode 100644
index 0000000000000..f06422dd967b8
--- /dev/null
+++ b/packages/lab/src/PageControl/__tests__/holdBegin.ts
@@ -0,0 +1,119 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+/**
+ * @file holdBegin.ts
+ * @input What the held-finger proof records on the page: the landing, the
+ * timer tasks and the commit that shows the held look, on the page's clock
+ * @output Where the hold began: the gesture arena's deadline timer, or an
+ * input dated after the deadline
+ * @position Shared by the PageControl held-finger proof
+ * (PageControl.interaction.browser.spec.ts) and its unit test
+ */
+
+/** UIPageControl's interaction delay, ms. */
+export const HOLD_MS = 155;
+/** WebKit's page clocks keep whole milliseconds. */
+export const CLOCK_SLOP_MS = 2;
+/**
+ * While a finger is down, the gesture arena waits this long for input still
+ * queued after a late deadline, or after a late input from before it, ms.
+ */
+export const QUEUED_INPUT_WAIT_MS = 50;
+
+/** A timer the page ran, on the page's clock. */
+export interface TimerTask {
+ id: number;
+ delay: number;
+ due: number;
+ ranAt: number | null;
+ scheduledAt: number;
+ /** The timer task that set it, if any. */
+ parentId: number | null;
+}
+
+/** The commit that shows the held look. */
+export interface HeldFlip {
+ at: number;
+ task: TimerTask | null;
+ /** The pointer or touch event being dispatched at the commit, if any. */
+ input: {type: string; timeStamp: number} | null;
+ fadedAt: number | null;
+}
+
+/** What the held-finger proof records on the page, on the page's clock. */
+export interface HeldClock {
+ /** The landing's pointer and touch event timeStamps. */
+ landings: number[];
+ /** When the page dispatched the landing, on the same clock. */
+ dispatchedAt: number;
+ /** The timer task that runs now. */
+ task: TimerTask | null;
+ timers: TimerTask[];
+ frames: number[];
+ flip: HeldFlip | null;
+}
+
+export interface HoldBegin {
+ /** The timer task of the commit, and the task that set it. */
+ task: TimerTask | null;
+ parent: TimerTask | undefined;
+ /** The earliest the deadline can be, as the gesture arena dates it. */
+ earliest: number;
+ /** The gesture arena's deadline timer, when the hold began from it. */
+ holdTimer: TimerTask | undefined;
+ /** An input dated after the deadline began the hold. */
+ isLateInput: boolean;
+}
+
+/** Where the hold began, for the commit that shows the held look. */
+export function holdBegin(clock: HeldClock, flip: HeldFlip): HoldBegin {
+ // The hold begins where the gesture arena learns its deadline has passed.
+ // That is the hold timer's own task, or the one 0 ms task the arena sets
+ // after the deadline when that timer ran late. While a finger is down, a
+ // late deadline or a late input from before it makes the arena wait 50 ms
+ // for input still queued, in a task of its own. A later late input extends
+ // the wait, and an input dated at or after the deadline ends it. It is
+ // also any input dated after the deadline that the page dispatches first.
+ // The look commits there.
+ const task = flip.task;
+ const byId = new Map(clock.timers.map(timer => [timer.id, timer]));
+ const parent = task?.parentId == null ? undefined : byId.get(task.parentId);
+ // The deadline is 155 ms after the landing, as the gesture arena dates it.
+ // The arena's clock never runs back, so a busy page that dispatches the
+ // landing late can date it as late as that dispatch.
+ const earliest = Math.min(...clock.landings) + HOLD_MS;
+ const latest = Math.max(clock.dispatchedAt, ...clock.landings) + HOLD_MS;
+ const isDeadline = (timer: TimerTask) =>
+ timer.due >= earliest - CLOCK_SLOP_MS &&
+ timer.due <= latest + CLOCK_SLOP_MS;
+ // The arena's own tasks after its deadline, each set from the task before
+ // it: the 0 ms yield and each 50 ms wait.
+ const isFollowUp = (timer: TimerTask) =>
+ (timer.delay === 0 || timer.delay === QUEUED_INPUT_WAIT_MS) &&
+ timer.scheduledAt >= earliest - CLOCK_SLOP_MS;
+ const deadlineOf = (timer: TimerTask | null | undefined) => {
+ let at = timer ?? undefined;
+ while (at != null && !isDeadline(at) && isFollowUp(at)) {
+ at = at.parentId == null ? undefined : byId.get(at.parentId);
+ }
+ return at != null && isDeadline(at) ? at : undefined;
+ };
+ // An input that ends a wait commits the look while that wait is pending.
+ // Only an input dated at or after the deadline ends it.
+ const pendingWait =
+ flip.input == null || flip.input.timeStamp < earliest - CLOCK_SLOP_MS
+ ? undefined
+ : clock.timers.find(
+ timer =>
+ timer.delay === QUEUED_INPUT_WAIT_MS &&
+ timer.scheduledAt <= flip.at &&
+ (timer.ranAt == null || timer.ranAt >= flip.at) &&
+ deadlineOf(timer) != null,
+ );
+ const holdTimer = deadlineOf(task) ?? deadlineOf(pendingWait);
+ const isLateInput =
+ holdTimer == null &&
+ flip.input != null &&
+ flip.input.timeStamp >= earliest - CLOCK_SLOP_MS;
+ return {task, parent, earliest, holdTimer, isLateInput};
+}
diff --git a/scripts/shared-identity.baseline.json b/scripts/shared-identity.baseline.json
index 823656ae62959..e52d5c12c0af8 100644
--- a/scripts/shared-identity.baseline.json
+++ b/scripts/shared-identity.baseline.json
@@ -49,6 +49,22 @@
"status": "allowed",
"reason": "A memo cache; a second cache per copy changes no result."
},
+ "packages/core/src/ContextMenu/contextMenuTouchLoader.ts:listeners": {
+ "status": "allowed",
+ "reason": "Each copy of Core loads and renders its own touch layer, whose component reads that copy's contexts; a second copy's load changes no result."
+ },
+ "packages/core/src/ContextMenu/contextMenuTouchLoader.ts:pendingLoad": {
+ "status": "allowed",
+ "reason": "Each copy of Core loads and renders its own touch layer, whose component reads that copy's contexts; a second copy's load changes no result."
+ },
+ "packages/core/src/ContextMenu/contextMenuTouchLoader.ts:scheduledViews": {
+ "status": "allowed",
+ "reason": "Each copy of Core loads and renders its own touch layer, whose component reads that copy's contexts; a second copy's load changes no result."
+ },
+ "packages/core/src/ContextMenu/contextMenuTouchLoader.ts:state": {
+ "status": "allowed",
+ "reason": "Each copy of Core loads and renders its own touch layer, whose component reads that copy's contexts; a second copy's load changes no result."
+ },
"packages/core/src/DateInput/monthGeometry.ts:GREGORIAN_MONTH_MODELS": {
"status": "allowed",
"reason": "A memo cache; a second cache per copy changes no result."