Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
4076bf3
spec(AST-094): touch presentations follow UIKit
vjeux Oct 24, 2026
4dc2aae
feat(core): one touch presentation resolver
vjeux Oct 24, 2026
9d2d720
feat(core): the touch presentation resolver knows the iOS idiom
vjeux Oct 24, 2026
7065daf
fix(core): one touch model on every device; the adaptive change is a …
cixzhang Oct 24, 2026
dc6ae1e
test(interaction): real touch input for browser interaction proofs
vjeux Oct 24, 2026
75fc6cb
fix(interaction): release only the lifted finger on a partial lift in…
vjeux Oct 24, 2026
0a07aa1
fix(interaction): join the proofs to test, keep their setup in scope,…
vjeux Oct 24, 2026
92ef66c
Merge main into wip/uikit-pr-touch-presentation
cixzhang Oct 24, 2026
5f2ed50
fix(interaction): releaseVelocity measures from when the finger reach…
vjeux Oct 24, 2026
398c723
fix(core): the touch resolver reads the theme's compact definition
cixzhang Oct 24, 2026
33ee284
docs(MoreMenu): keep the doc's own formatting; change only the compac…
cixzhang Oct 24, 2026
d3c13cc
test(interaction): curve sampling and deterministic storyboards
vjeux Oct 24, 2026
65c017e
fix(interaction): curves end before a held end value; rest judges pre…
vjeux Oct 24, 2026
d8af73a
fix(interaction): hold only running animations at their own offsets, …
vjeux Oct 24, 2026
1264c5b
fix(core): compact follows the active theme's md; the branch drops it…
cixzhang Oct 24, 2026
ec08340
docs(spec): drop this branch's stacked copy of AST-094
cixzhang Oct 24, 2026
ced7766
docs(ContextMenu, MoreMenu): the compact edge is the theme md breakpoint
cixzhang Oct 25, 2026
4d728a7
refactor(core): drop the unused isCompactTouch from the touch present…
vjeux Oct 25, 2026
d34d800
test(core): the adaptive menu's compact edges in Chromium and WebKit
vjeux Oct 25, 2026
2e170f5
fix(interaction): film from each animation's own offset, label sample…
vjeux Oct 25, 2026
04cbfc5
fix(interaction): waitForAnimation sees a short animation that ended …
vjeux Oct 25, 2026
d29981d
refactor(interaction): the storyboard layer moves to its own pull req…
vjeux Oct 25, 2026
c5efd27
Merge main into #8062 (lab typecheck fix aa3b92f320 and current main)
vjeux Oct 25, 2026
beecc80
test(interaction): a second hold adds to the held set
vjeux Oct 25, 2026
4a6dfbe
test(interaction): deterministic storyboards
vjeux Oct 25, 2026
eec2404
test(interaction): a touch filmstrip's handler clock follows its pacing
vjeux Oct 25, 2026
0954697
test(interaction): frame evidence and the BottomSheet exemplar
vjeux Oct 24, 2026
6be18c6
test(interaction): make the busy-main-thread verdict robust to a load…
vjeux Oct 24, 2026
3f39b21
test(BottomSheet): pin the settle's easing and duration instead of re…
vjeux Oct 24, 2026
03eadf9
test(interaction): block after the frame's rendering update; rebase W…
vjeux Oct 25, 2026
ffc2bd4
Merge branch 'main' into interaction-harness-2-curves
vjeux Oct 25, 2026
e918a2f
Merge branch 'interaction-harness-2-curves' into uikit/f3-storyboards
vjeux Oct 25, 2026
79a1fed
Merge branch 'uikit/f3-storyboards' into interaction-harness-3-frames
vjeux Oct 25, 2026
b8642ba
test(core): the touch presentation's browser proofs leave for the des…
vjeux Oct 25, 2026
f809dae
test(DropdownMenu): a sub-menu's drill-in follows a theme that moves md
vjeux Oct 25, 2026
4b5e872
refactor(core): readTouchPresentation takes the compact definition it…
vjeux Oct 25, 2026
0c31557
Merge #8045 (the interaction harness) into the touch presentation's b…
vjeux Oct 25, 2026
23cdedc
test(core): the touch presentation's browser proofs run on the intera…
vjeux Oct 25, 2026
0cacacf
Merge main 39ed04d76f (the interaction harness and the touch presenta…
vjeux Oct 27, 2026
f9638b4
chore(core): the touch presentation proofs carry only their own files…
vjeux Oct 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.

/**
* @file adaptiveEdges.interaction.browser.spec.ts
* @input fixture.ts bundled with esbuild, mounted in four frames sized at the
* compact edges; the interaction harness's phone
* (playwright.interaction.config.ts), and the same engines with a mouse
* @output Where an adaptive menu takes the bottom sheet: at 767 px wide and
* 499 px tall under a finger, never at 768 or 500, never with a mouse
* @position Real-engine proof of the compact definition (`spec:AST-012`
* FR9) as useAdaptivePresentation reads it
*
* A frame's media queries read the frame's own size, so one page holds all
* four edges; the pointer is the device's. The same page, opened in Safari,
* is the manual Safari check.
*/

import path from 'node:path';
import {fileURLToPath} from 'node:url';
import {build} from 'esbuild';
import {expect, test, type Page} from '@playwright/test';

const EDGES = [
{name: 'w767', width: 767, height: 900, compact: true},
{name: 'w768', width: 768, height: 900, compact: false},
{name: 'h499', width: 1024, height: 499, compact: true},
{name: 'h500', width: 1024, height: 500, compact: false},
] as const;

let bundle = '';

test.beforeAll(async () => {
const result = await build({
entryPoints: [
path.join(path.dirname(fileURLToPath(import.meta.url)), 'fixture.ts'),
],
bundle: true,
write: false,
format: 'iife',
platform: 'browser',
target: 'es2022',
define: {'process.env.NODE_ENV': '"production"'},
});
bundle = result.outputFiles[0].text;
});

async function expectEdges(page: Page, coarse: boolean) {
await page.goto('about:blank');
await page.setContent(
'<!doctype html><meta name="viewport" content="width=device-width, initial-scale=1"><body></body>',
);
expect(
await page.evaluate(() => matchMedia('(pointer: coarse)').matches),
).toBe(coarse);
await page.evaluate(
({edges, script}) => {
for (const edge of edges) {
const frame = document.createElement('iframe');
frame.name = edge.name;
frame.width = String(edge.width);
frame.height = String(edge.height);
frame.style.border = '0';
frame.style.display = 'block';
frame.srcdoc = `<!doctype html><body><script>${script}</script></body>`;
document.body.append(frame);
}
},
{edges: EDGES, script: bundle.replace(/<\/script/gi, '<\\/script')},
);
for (const edge of EDGES) {
await expect.poll(() => page.frame({name: edge.name}) != null).toBe(true);
const frame = page.frame({name: edge.name});
if (frame == null) {
throw new Error(`no frame named ${edge.name}`);
}
await frame.waitForFunction(() => window.__answers != null);
const answers = await frame.evaluate(() => window.__answers);
expect(answers, edge.name).toMatchObject({
width: edge.width,
height: edge.height,
coarse,
presentation: {isTouch: coarse, isCompact: edge.compact},
adaptive: coarse && edge.compact ? 'bottom-sheet' : 'popover',
});
}
}

test('under a finger, an adaptive menu takes the sheet only below the compact edges', async ({
page,
}) => {
await expectEdges(page, true);
});

test.describe('with a mouse', () => {
test.use({hasTouch: false, isMobile: false});

test('an adaptive menu never takes the sheet', async ({page}) => {
await expectEdges(page, false);
});
});
70 changes: 70 additions & 0 deletions packages/core/src/utils/__tests__/browser/fixture.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.

'use client';

/**
* @file fixture.ts
* @input Nothing: bundled by esbuild and injected into a blank page
* @output The resolver's answers on `window.__answers` (hooks after
* hydration, the one-moment read, the engine facts), and two styled probes:
* one under the touch query, one under the iOS gate written as core writes
* it (the media query outside, the supports query inside)
* @position Browser fixture of touchPresentation.interaction.browser.spec.ts
* and adaptiveEdges.interaction.browser.spec.ts; test-only
*/

import {createElement, useEffect} from 'react';
import {createRoot} from 'react-dom/client';
import {
IOS_SUPPORTS_QUERY,
IOS_TOUCH_STYLE_KEYS,
TOUCH_QUERY,
readTouchPresentation,
useTouchPresentation,
} from '../../touchPresentation';
import {useAdaptivePresentation} from '../../../hooks/useAdaptivePresentation';
import {DEFAULT_COMPACT_DEFINITION} from '../../../theme/themeAdaptations';

declare global {
interface Window {
__answers: Record<string, unknown> | null;
}
}

window.__answers = null;

const style = document.createElement('style');
style.textContent = `
#touch, #gate { color: rgb(0, 0, 255); }
${IOS_TOUCH_STYLE_KEYS[0]} { #touch { color: rgb(255, 0, 0); } }
${IOS_TOUCH_STYLE_KEYS[0]} { ${IOS_TOUCH_STYLE_KEYS[1]} { #gate { color: rgb(255, 0, 0); } } }
`;
document.head.append(style);

function Probe() {
const presentation = useTouchPresentation();
// What an adaptive menu presents here: the sheet needs a coarse pointer
// and a compact viewport (spec:AST-012 FR9).
const adaptive = useAdaptivePresentation('adaptive');
useEffect(() => {
window.__answers = {
width: window.innerWidth,
height: window.innerHeight,
adaptive,
presentation,
read: readTouchPresentation(window, DEFAULT_COMPACT_DEFINITION),
touchCallout: CSS.supports(IOS_SUPPORTS_QUERY),
coarse: matchMedia(TOUCH_QUERY).matches,
};
});
return createElement(
'div',
null,
createElement('p', {id: 'touch'}, 'touch'),
createElement('p', {id: 'gate'}, 'iOS gate'),
);
}

const root = document.createElement('div');
document.body.append(root);
createRoot(root).render(createElement(Probe));
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.

/**
* @file touchPresentation.interaction.browser.spec.ts
* @input fixture.ts bundled with esbuild; the interaction harness's phone
* (playwright.interaction.config.ts) in Chromium and WebKit
* @output What each engine answers: a coarse pointer and a compact viewport
* in both, the same touch presentation; no -webkit-touch-callout in either
* (only WebKit on iOS and iPadOS implements it); a style under the touch
* query applies while one under the iOS style gate does not
* @position Real-engine proof of packages/core/src/utils/touchPresentation.ts.
*/

import path from 'node:path';
import {fileURLToPath} from 'node:url';
import {build} from 'esbuild';
import {expect, test, type Page} from '@playwright/test';

let bundle = '';

test.beforeAll(async () => {
const result = await build({
entryPoints: [
path.join(path.dirname(fileURLToPath(import.meta.url)), 'fixture.ts'),
],
bundle: true,
write: false,
format: 'iife',
platform: 'browser',
target: 'es2022',
define: {'process.env.NODE_ENV': '"production"'},
});
bundle = result.outputFiles[0].text;
});

async function open(page: Page) {
await page.goto('about:blank');
await page.setContent(
'<!doctype html><meta name="viewport" content="width=device-width, initial-scale=1"><body></body>',
);
await page.addScriptTag({content: bundle});
await page.waitForFunction(() => window.__answers != null);
return page.evaluate(() => window.__answers);
}

const color = async (page: Page, id: string) =>
page.evaluate(
target =>
getComputedStyle(document.getElementById(target) as Element).color,
id,
);

test('a finger gets the touch presentation in every engine', async ({page}) => {
const answers = await open(page);
expect(answers).toMatchObject({
coarse: true,
touchCallout: false,
presentation: {isTouch: true, isCompact: true},
read: {isTouch: true, isCompact: true},
});
// The touch style applies; the iOS-only style does not.
expect(await color(page, 'touch')).toBe('rgb(255, 0, 0)');
expect(await color(page, 'gate')).toBe('rgb(0, 0, 255)');
});
Loading