Skip to content
Merged
Changes from 4 commits
Commits
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
Expand Up @@ -301,14 +301,24 @@
await page.evaluate(() => {
const frames = {
samples: [] as [number, number][],
moveStamp: Number.NEGATIVE_INFINITY,
upStamp: Number.POSITIVE_INFINITY,
upAt: Number.POSITIVE_INFINITY,
done: false,
};
(window as unknown as {sheetFrames: typeof frames}).sheetFrames = frames;
window.addEventListener(
'pointermove',
event => {
frames.moveStamp = event.timeStamp;
},
{capture: true},
);
window.addEventListener(
'pointerup',
() => {
event => {
frames.upAt = performance.now();
frames.upStamp = event.timeStamp;
},
{capture: true},
);
Expand Down Expand Up @@ -352,20 +362,44 @@
return played;
});
expect(exitPlayed).toBe(false);
await expect(dialog).toBeHidden({timeout: 2_000});
const read = async () =>
page.evaluate(
() =>
(
window as unknown as {
sheetFrames: {
samples: [number, number][];
moveStamp: number;
upStamp: number;
upAt: number;
done: boolean;
};
}
).sheetFrames,
);
// The sheet drops aria-modal when the release asks it to close. A release
// read as still projects short of the dismiss line and keeps it. The gap
// uses the events' own times: CDP delivers them back to back.
const lift = await read();
const gap = Math.round(lift.upStamp - lift.moveStamp);
// Read the DOM, not the accessibility tree: a closing dialog leaves the
// tree, so a role locator finds nothing once the close has started.
Comment on lines +385 to +386

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: a closing sheet that holds focus stays neither inert nor aria-hidden until the close settles (BottomSheet.tsx:932-941), so the dialog leaves the accessibility tree when it closes, not when the close starts. Suggested wording:

  // Read the DOM, not the accessibility tree: the dialog leaves the tree
  // when it closes, and a slow runner can reach that before this check.

await expect
.poll(
() =>

Check failure on line 389 in packages/core/src/BottomSheet/__tests__/BottomSheetRelease.a11y.chromium.spec.ts

View workflow job for this annotation

GitHub Actions / lint

Functions that return promises must be async
Comment thread
astracat-bot[bot] marked this conversation as resolved.
Resolved
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`,
Comment thread
astracat-bot[bot] marked this conversation as resolved.
Resolved
timeout: 2_000,
},
)
.toBeNull();
await expect(dialog).toBeHidden({timeout: 2_000});
await expect
.poll(async () => (await read()).done, {timeout: 2_000})
.toBe(true);
Expand Down
Loading