From f28e1a133ad063f05d70e785f1aae47232681388 Mon Sep 17 00:00:00 2001 From: Cindy Zhang Date: Mon, 9 Nov 2026 08:08:54 -0800 Subject: [PATCH 1/2] test(BottomSheet): timestamp the reduced-motion mouse close Co-authored-by: astracat-bot[bot] <323722387+astracat-bot[bot]@users.noreply.github.com> --- .../BottomSheetRelease.a11y.chromium.spec.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/core/src/BottomSheet/__tests__/BottomSheetRelease.a11y.chromium.spec.ts b/packages/core/src/BottomSheet/__tests__/BottomSheetRelease.a11y.chromium.spec.ts index 39966c257d568..9668e090bc965 100644 --- a/packages/core/src/BottomSheet/__tests__/BottomSheetRelease.a11y.chromium.spec.ts +++ b/packages/core/src/BottomSheet/__tests__/BottomSheetRelease.a11y.chromium.spec.ts @@ -3,8 +3,8 @@ /** * @file BottomSheetRelease.a11y.chromium.spec.ts - * @input Built BottomSheet stories and real Chromium touch input (CDP), each - * event with its own timestamp + * @input Built BottomSheet stories and real Chromium touch and mouse input + * (CDP), each event with its own timestamp * @output Browser evidence for the touch release: a fast short flick closes * a sheet at its lowest detent, and its exit starts at the flick's speed. * From the top snap point, a flick whose projection stops short of the @@ -323,12 +323,10 @@ test('a mouse close under reduced motion moves the sheet no further', async ({ }; requestAnimationFrame(record); }); - const x = rest.x + rest.width / 2; - const y = rest.y + 12; - await page.mouse.move(x, y); - await page.mouse.down(); - await page.mouse.move(x, y + 150, {steps: 5}); - await page.mouse.up(); + const cdp = await page.context().newCDPSession(page); + // 150 px in 50 ms is 3,000 px/s, so the mouse release projects past the + // dismiss line even when event delivery is slow. + await mouseDrag(cdp, sheet, 150, 50); // While the dialog closes, no drag exit plays: no inline transition and no // animation moves the sheet. const exitPlayed = await page.evaluate(async () => { From 6a455da58c3c60540f8c2589a1f073076f6c4ab7 Mon Sep 17 00:00:00 2001 From: Cindy Zhang Date: Mon, 9 Nov 2026 09:50:31 -0800 Subject: [PATCH 2/2] test(BottomSheet): poll the DOM for the close request, not the accessibility tree --- .../BottomSheetRelease.a11y.chromium.spec.ts | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/packages/core/src/BottomSheet/__tests__/BottomSheetRelease.a11y.chromium.spec.ts b/packages/core/src/BottomSheet/__tests__/BottomSheetRelease.a11y.chromium.spec.ts index 30f53a8d1b111..82035bf856f57 100644 --- a/packages/core/src/BottomSheet/__tests__/BottomSheetRelease.a11y.chromium.spec.ts +++ b/packages/core/src/BottomSheet/__tests__/BottomSheetRelease.a11y.chromium.spec.ts @@ -382,10 +382,23 @@ test('a mouse close under reduced motion moves the sheet no further', async ({ // uses the events' own times: CDP delivers them back to back. const lift = await read(); const gap = Math.round(lift.upStamp - lift.moveStamp); - await expect( - dialog, - `the release did not ask the sheet to close: the drag read as a still release (${gap} ms from the last move to the lift), so its projection stayed short of the dismiss line`, - ).not.toHaveAttribute('aria-modal', 'true', {timeout: 2_000}); + // Read the DOM, not the accessibility tree: a closing dialog leaves the + // tree, so a role locator finds nothing once the close has started. + await expect + .poll( + () => + page.evaluate( + () => + document + .querySelector('dialog[open]') + ?.getAttribute('aria-modal') ?? null, + ), + { + message: `the release did not ask the sheet to close: the drag read as a still release (${gap} ms from the last move to the lift), so its projection stayed short of the dismiss line`, + timeout: 2_000, + }, + ) + .toBeNull(); await expect(dialog).toBeHidden({timeout: 2_000}); await expect .poll(async () => (await read()).done, {timeout: 2_000})