Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(useAnnounce): messages announced in the same frame are joined, an identical repeat once (#8244)

Cindy Zhangd794476b617a
diff --git a/.changeset/announce-same-frame-join.md b/.changeset/announce-same-frame-join.md
new file mode 100644
index 0000000000..e8af16beed
--- /dev/null
+++ b/.changeset/announce-same-frame-join.md
@@ -0,0 +1,7 @@
+---
+'@astryxdesign/core': patch
+---
+
+[fix] useAnnounce: messages announced in the same frame are now joined, in order, into one announcement instead of the last one replacing the others, and an identical repeat is spoken once, so a screen reader no longer misses an earlier status such as a result count announced alongside a confirmation. An empty message still clears the region, including joined messages not yet spoken. This meets the shared-channel requirement in spec:AST-086 (FR9).
+
+@cixzhang
diff --git a/packages/core/src/MultiSelector/MultiSelector.test.tsx b/packages/core/src/MultiSelector/MultiSelector.test.tsx
index 3019121caa..c2ea5dc873 100644
--- a/packages/core/src/MultiSelector/MultiSelector.test.tsx
+++ b/packages/core/src/MultiSelector/MultiSelector.test.tsx
@@ -37,6 +37,20 @@ import {groupStyles} from '../InputGroup/groupStyles';
import {InputGroup, InputGroupText} from '../InputGroup';
import {colorVars, focusVars} from '../theme/tokens.stylex';
+/**
+ * Enters a search query as one change. Typing it key by key can land several
+ * keystrokes in one frame, whose result announcements are then joined into
+ * one (spec:AST-086 FR9), so a test of what one query announces pastes it.
+ */
+async function enterQuery(
+ user: ReturnType<typeof userEvent.setup>,
+ input: HTMLElement,
+ query: string,
+): Promise<void> {
+ await user.click(input);
+ await user.paste(query);
+}
+
function generateThemeTestCSS(theme: Parameters<typeof generateThemeCSS>[0]) {
const {prose, component} = generateThemeCSS(theme);
return [prose, component].filter(Boolean).join('\n\n');
@@ -1172,7 +1186,7 @@ describe('MultiSelector', () => {
);
await user.click(screen.getByRole('button', {name: 'Fruit'}));
- await user.type(screen.getByRole('combobox', h), 'xyz');
+ await enterQuery(user, screen.getByRole('combobox', h), 'xyz');
// The panel message is role="presentation", so the live region is the
// only thing a screen reader gets — it has to say the same words.
@@ -1204,7 +1218,7 @@ describe('MultiSelector', () => {
);
await user.click(screen.getByRole('button', {name: 'Fruit'}));
- await user.type(screen.getByRole('combobox', h), 'xyz');
+ await enterQuery(user, screen.getByRole('combobox', h), 'xyz');
await waitFor(() =>
expect(politeRegion()?.textContent).toBe(
@@ -1258,7 +1272,7 @@ describe('MultiSelector', () => {
);
await user.click(screen.getByRole('button', {name: 'Fruit'}));
- await user.type(screen.getByRole('combobox', h), 'xyz');
+ await enterQuery(user, screen.getByRole('combobox', h), 'xyz');
await waitFor(() =>
expect(politeRegion()?.textContent).toBe('Nothing like that here'),
@@ -1396,7 +1410,7 @@ describe('MultiSelector', () => {
);
await user.click(screen.getByRole('button', {name: 'Fruit'}));
// "an" matches Banana and Orange.
- await user.type(screen.getByRole('combobox', h), 'an');
+ await enterQuery(user, screen.getByRole('combobox', h), 'an');
await waitFor(() => {
// The plural branch of a message no catalog supplies.
expect(politeRegion()?.textContent).toBe('2 résultats');
@@ -1425,7 +1439,7 @@ describe('MultiSelector', () => {
);
await user.click(screen.getByRole('button', {name: 'Fruit'}));
// "app" matches only Apple. Exact match, so "1 résultats" would fail.
- await user.type(screen.getByRole('combobox', h), 'app');
+ await enterQuery(user, screen.getByRole('combobox', h), 'app');
await waitFor(() => {
expect(politeRegion()?.textContent).toBe('1 résultat');
});
@@ -1449,7 +1463,7 @@ describe('MultiSelector', () => {
</InternationalizationProvider>,
);
await user.click(screen.getByRole('button', {name: 'Fruit'}));
- await user.type(screen.getByRole('combobox', h), 'xyz');
+ await enterQuery(user, screen.getByRole('combobox', h), 'xyz');
await waitFor(() => {
expect(politeRegion()?.textContent).toBe('Aucun résultat');
});
@@ -1479,7 +1493,7 @@ describe('MultiSelector', () => {
);
await user.click(screen.getByRole('button', {name: 'Fruit'}));
// "an" matches Banana and Orange.
- await user.type(screen.getByRole('combobox', h), 'an');
+ await enterQuery(user, screen.getByRole('combobox', h), 'an');
await waitFor(() => {
// Same key through the catalog path rather than `overrides`.
expect(politeRegion()?.textContent).toBe('2 résultats');
@@ -3884,7 +3898,7 @@ describe('MultiSelector hasCreate', () => {
/>,
);
await user.click(screen.getByRole('button', {name: 'Labels'}));
- await user.type(screen.getByRole('combobox', h), 'Urgent');
+ await enterQuery(user, screen.getByRole('combobox', h), 'Urgent');
// The empty-state message is role="presentation", so the live region is
// what a screen reader gets — it must say what is on screen: a row.
await waitFor(() => {
diff --git a/packages/core/src/Selector/Selector.test.tsx b/packages/core/src/Selector/Selector.test.tsx
index 3c90bded7f..dc3b6faa6c 100644
--- a/packages/core/src/Selector/Selector.test.tsx
+++ b/packages/core/src/Selector/Selector.test.tsx
@@ -40,6 +40,20 @@ import {colorVars, spacingVars} from '../theme/tokens.stylex';
import {selectorPresentationStyles} from './selectorPresentation.stylex';
import {groupStyles} from '../InputGroup/groupStyles';
+/**
+ * Enters a search query as one change. Typing it key by key can land several
+ * keystrokes in one frame, whose result announcements are then joined into
+ * one (spec:AST-086 FR9), so a test of what one query announces pastes it.
+ */
+async function enterQuery(
+ user: ReturnType<typeof userEvent.setup>,
+ input: HTMLElement,
+ query: string,
+): Promise<void> {
+ await user.click(input);
+ await user.paste(query);
+}
+
function generateThemeTestCSS(theme: Parameters<typeof generateThemeCSS>[0]) {
const {prose, component} = generateThemeCSS(theme);
return [prose, component].filter(Boolean).join('\n\n');
@@ -1246,7 +1260,7 @@ describe('Selector', () => {
/>,
);
await user.click(screen.getByRole('button', {name: 'Fruit'}));
- await user.type(screen.getByRole('combobox', h), 'xyz');
+ await enterQuery(user, screen.getByRole('combobox', h), 'xyz');
// The panel message is role="presentation", so the live region is the
// only thing a screen reader gets — it has to say the same words.
@@ -1277,7 +1291,7 @@ describe('Selector', () => {
/>,
);
await user.click(screen.getByRole('button', {name: 'Fruit'}));
- await user.type(screen.getByRole('combobox', h), 'xyz');
+ await enterQuery(user, screen.getByRole('combobox', h), 'xyz');
await waitFor(() =>
expect(politeRegion()?.textContent).toBe(
@@ -1328,7 +1342,7 @@ describe('Selector', () => {
/>,
);
await user.click(screen.getByRole('button', {name: 'Fruit'}));
- await user.type(screen.getByRole('combobox', h), 'xyz');
+ await enterQuery(user, screen.getByRole('combobox', h), 'xyz');
await waitFor(() =>
expect(politeRegion()?.textContent).toBe('Nothing like that here'),
@@ -1362,7 +1376,7 @@ describe('Selector', () => {
}
const {rerender} = render(<Deferred loaded={false} />);
- await user.type(screen.getByRole('combobox', h), 'xyz');
+ await enterQuery(user, screen.getByRole('combobox', h), 'xyz');
// Loading: the panel shows nothing, so the region claims nothing.
expect(politeRegion()?.textContent ?? '').toBe('');
@@ -1682,7 +1696,7 @@ describe('Selector', () => {
);
await user.click(screen.getByRole('button', {name: 'Fruit'}));
// "ban" matches only Banana. Exact, so "1 résultats" would fail.
- await user.type(screen.getByRole('combobox', h), 'ban');
+ await enterQuery(user, screen.getByRole('combobox', h), 'ban');
await waitFor(() => {
expect(politeRegion()?.textContent).toBe('1 résultat');
});
@@ -1706,7 +1720,7 @@ describe('Selector', () => {
</InternationalizationProvider>,
);
await user.click(screen.getByRole('button', {name: 'Fruit'}));
- await user.type(screen.getByRole('combobox', h), 'xyz');
+ await enterQuery(user, screen.getByRole('combobox', h), 'xyz');
await waitFor(() => {
expect(politeRegion()?.textContent).toBe('Aucun résultat');
});
diff --git a/packages/core/src/hooks/useAnnounce.doc.mjs b/packages/core/src/hooks/useAnnounce.doc.mjs
index 34dd31529d..522f3ddfda 100644
--- a/packages/core/src/hooks/useAnnounce.doc.mjs
+++ b/packages/core/src/hooks/useAnnounce.doc.mjs
@@ -24,7 +24,7 @@ export const docs = {
name: 'announce',
type: '(message: string, politeness?: "polite" | "assertive") => void',
description:
- 'Speaks a message through the shared live region. Politeness defaults to "polite"; an empty message clears any lingering status instead of announcing.',
+ 'Speaks a message through the shared live region. Politeness defaults to "polite"; messages announced in the same frame are joined, in order, into one announcement, and an identical repeat is kept once. An empty message clears any lingering status, including joined messages not yet spoken, instead of announcing.',
},
],
usage: {
@@ -65,7 +65,7 @@ export const docsDense = {
'Imperative screen-reader announcements via a visually-hidden live region. Polite + assertive regions created empty on first use + kept mounted, so announcements are reliable (most AT ignore a live region inserted together w/ its content). Messages auto-clear after ~2s.',
returnDescriptions: {
announce:
- 'speaks message through shared live region. politeness defaults "polite"; empty message clears lingering status.',
+ 'speaks message through shared live region. politeness defaults "polite"; same-frame messages join in order, identical repeat kept once; empty message clears lingering + not-yet-spoken status.',
},
usage: {
description:
diff --git a/packages/core/src/hooks/useAnnounce.test.tsx b/packages/core/src/hooks/useAnnounce.test.tsx
index 9a3248aafa..01ffaefec5 100644
--- a/packages/core/src/hooks/useAnnounce.test.tsx
+++ b/packages/core/src/hooks/useAnnounce.test.tsx
@@ -48,18 +48,78 @@ describe('useAnnounce', () => {
},
);
- it('preserves multiple same-frame announcements until explicitly cleared', () => {
+ it.each(['polite', 'assertive'] as const)(
+ 'joins %s messages announced in the same frame, in order (AST-086 FR9)',
+ politeness => {
+ vi.useFakeTimers();
+ try {
+ const {result} = renderHook(() => useAnnounce());
+ result.current('3 results', politeness);
+ result.current('Filter applied', politeness);
+ const region =
+ politeness === 'polite' ? politeRegion()! : assertiveRegion()!;
+ const write = vi.spyOn(region, 'textContent', 'set');
+ act(() => {
+ vi.advanceTimersByTime(50);
+ });
+ // One write exposes both; neither is dropped or exposed alone.
+ expect(write.mock.calls).toEqual([['3 results Filter applied']]);
+ write.mockRestore();
+ } finally {
+ vi.useRealTimers();
+ }
+ },
+ );
+
+ it('keeps an identical message repeated in the same frame once (AST-086 FR9)', () => {
+ vi.useFakeTimers();
+ try {
+ const {result} = renderHook(() => useAnnounce());
+ result.current('1 result');
+ result.current('Filter applied');
+ result.current('1 result');
+ act(() => {
+ vi.advanceTimersByTime(50);
+ });
+ expect(politeRegion()!.textContent).toBe('1 result Filter applied');
+ } finally {
+ vi.useRealTimers();
+ }
+ });
+
+ it('starts a new announcement for a message after the joined one is exposed (AST-086 FR9)', () => {
+ vi.useFakeTimers();
+ try {
+ const {result} = renderHook(() => useAnnounce());
+ result.current('First');
+ result.current('Second');
+ act(() => {
+ vi.advanceTimersByTime(50);
+ });
+ expect(politeRegion()).toHaveTextContent('First Second');
+ result.current('Third');
+ act(() => {
+ vi.advanceTimersByTime(50);
+ });
+ expect(politeRegion()!.textContent).toBe('Third');
+ } finally {
+ vi.useRealTimers();
+ }
+ });
+
+ it('clears messages joined but not yet exposed (AST-086 FR9)', () => {
vi.useFakeTimers();
try {
const {result} = renderHook(() => useAnnounce());
result.current('First');
result.current('Second');
- const write = vi.spyOn(politeRegion()!, 'textContent', 'set');
+ result.current('');
+ result.current('Third');
act(() => {
vi.advanceTimersByTime(50);
});
- expect(write.mock.calls).toEqual([['First'], ['Second']]);
- write.mockRestore();
+ // The clear dropped First and Second; only the later message is exposed.
+ expect(politeRegion()!.textContent).toBe('Third');
} finally {
vi.useRealTimers();
}
diff --git a/packages/core/src/hooks/useAnnounce.ts b/packages/core/src/hooks/useAnnounce.ts
index c5ea98ad71..e1092afeaf 100644
--- a/packages/core/src/hooks/useAnnounce.ts
+++ b/packages/core/src/hooks/useAnnounce.ts
@@ -4,7 +4,7 @@
/**
* @file useAnnounce.ts
- * @input Uses React useCallback; DOM APIs and cancellable animation frames for a singleton live-region pair
+ * @input Uses React useCallback; DOM APIs and one cancellable animation frame per region for a singleton live-region pair
* @output Exports useAnnounce hook and AnnouncePoliteness type
* @position Core a11y hook; provides imperative screen-reader announcements
* via persistently-mounted polite/assertive live regions; regions are
@@ -72,16 +72,35 @@ function cancelScheduledClear(politeness: AnnouncePoliteness): void {
}
}
-const pendingFrames: Record<AnnouncePoliteness, Set<number>> = {
- polite: new Set(),
- assertive: new Set(),
+// Messages announced before the region exposes them (written in the same
+// frame) wait here and are exposed together, in order, so none is dropped;
+// an identical repeat is the same message and is kept once (spec:AST-086
+// FR9). One frame per region writes them.
+const pendingFrames: Record<AnnouncePoliteness, number | null> = {
+ polite: null,
+ assertive: null,
+};
+// Each pending message counts the announcers waiting on it, so one of them
+// withdrawing it (a busy start overtaken by its outcome) leaves it in place
+// for the others.
+interface PendingMessage {
+ text: string;
+ holders: number;
+}
+const pendingMessages: Record<AnnouncePoliteness, PendingMessage[]> = {
+ polite: [],
+ assertive: [],
};
+// The pending message the latest announce joined, until its announcer takes it.
+let lastJoined: PendingMessage | null = null;
function cancelPendingFrames(politeness: AnnouncePoliteness): void {
- for (const frame of pendingFrames[politeness]) {
+ const frame = pendingFrames[politeness];
+ if (frame != null) {
cancelAnimationFrame(frame);
+ pendingFrames[politeness] = null;
}
- pendingFrames[politeness].clear();
+ pendingMessages[politeness] = [];
}
function scheduleClear(
@@ -143,16 +162,31 @@ function announceMessage(
return;
}
const target = politeness === 'assertive' ? r.assertive : r.polite;
- // Clearing first guarantees the mutation is observed even when the new
- // message equals the current text — some AT deduplicate identical content.
- target.textContent = '';
- // A microtask/rAF-free re-set in the next frame is more reliable across AT
- // than an immediate re-set, which can be coalesced with the clear.
- const frame = requestAnimationFrame(() => {
- pendingFrames[politeness].delete(frame);
- target.textContent = message;
- });
- pendingFrames[politeness].add(frame);
+ const repeat = pendingMessages[politeness].find(
+ pending => pending.text === message,
+ );
+ if (repeat != null) {
+ repeat.holders += 1;
+ lastJoined = repeat;
+ return;
+ }
+ const pending = {text: message, holders: 1};
+ pendingMessages[politeness].push(pending);
+ lastJoined = pending;
+ if (pendingFrames[politeness] == null) {
+ // Clearing first guarantees the mutation is observed even when the new
+ // message equals the current text — some AT deduplicate identical content.
+ target.textContent = '';
+ // A re-set in the next frame is more reliable across AT than an immediate
+ // re-set, which can be coalesced with the clear.
+ pendingFrames[politeness] = requestAnimationFrame(() => {
+ pendingFrames[politeness] = null;
+ target.textContent = pendingMessages[politeness]
+ .map(pending => pending.text)
+ .join(' ');
+ pendingMessages[politeness] = [];
+ });
+ }
// Auto-clear so the last message does not linger in the accessibility tree
// indefinitely. Scheduled per announce, so a newer announcement always
// resets the countdown (the delay comfortably outlasts the rAF re-set).
@@ -182,7 +216,8 @@ function clearRegion(politeness: AnnouncePoliteness): void {
* The polite and assertive regions are created once on first use and kept
* mounted, so announcements are reliable even for messages that appear
* immediately (unlike a live region rendered together with its content).
- * Each message is automatically cleared a couple of seconds after being
+ * Messages announced in the same frame are joined, in order, into one
+ * announcement, and an identical repeat is kept once. Each message is automatically cleared a couple of seconds after being
* announced, so users browsing the DOM later do not encounter stale status
* text; announcing again before the clear simply resets the countdown.
*
@@ -201,8 +236,9 @@ export function useAnnounce(): AnnounceFn {
return useCallback(
(message: string, politeness: AnnouncePoliteness = 'polite') => {
if (!message) {
- // An empty message clears any lingering status from the region rather
- // than announcing nothing — useful when the triggering context ends.
+ // An empty message clears any lingering status from the region,
+ // including messages joined but not yet exposed — useful when the
+ // triggering context ends.
clearRegion(politeness);
return;
}
@@ -212,6 +248,41 @@ export function useAnnounce(): AnnounceFn {
);
}
+/**
+ * Takes the pending message the latest announce joined, so that announcer can
+ * withdraw its own share of it later. Shared with useBusyAnnouncement; not
+ * exported from the hooks index.
+ *
+ * @internal
+ */
+export function takeJoinedAnnouncement(): object | null {
+ const joined = lastJoined;
+ lastJoined = null;
+ return joined;
+}
+
+/**
+ * Withdraws one announcer's share of a message still waiting to be exposed, so
+ * a busy start overtaken by its own outcome is never spoken (spec:AST-086 FR8).
+ * The message stays while another announcer still holds it.
+ *
+ * @internal
+ */
+export function withdrawPendingAnnouncement(
+ joined: object,
+ politeness: AnnouncePoliteness,
+): void {
+ const pending = pendingMessages[politeness];
+ const index = pending.indexOf(joined as PendingMessage);
+ if (index < 0) {
+ return;
+ }
+ pending[index].holders -= 1;
+ if (pending[index].holders <= 0) {
+ pending.splice(index, 1);
+ }
+}
+
/**
* Test-only helper: removes the singleton live regions and resets state so
* each test starts clean. Not part of the public runtime API.
@@ -223,6 +294,7 @@ export function __resetLiveRegionsForTest(): void {
cancelPendingFrames('assertive');
cancelScheduledClear('polite');
cancelScheduledClear('assertive');
+ lastJoined = null;
if (regions) {
regions.polite.remove();
regions.assertive.remove();
diff --git a/packages/core/src/hooks/useBusyAnnouncement.test.tsx b/packages/core/src/hooks/useBusyAnnouncement.test.tsx
index f1153a60e6..e6b0485b86 100644
--- a/packages/core/src/hooks/useBusyAnnouncement.test.tsx
+++ b/packages/core/src/hooks/useBusyAnnouncement.test.tsx
@@ -63,6 +63,36 @@ describe('useBusyAnnouncement', () => {
expect(politeText()).toBe('');
});
+ it('withdraws a busy start written to the channel but not yet exposed (AST-086 FR8)', () => {
+ const {result} = renderBusy();
+ // The busy frame writes "Loading" to the channel; its exposing frame has
+ // not run yet when the outcome announces and settles.
+ act(() => {
+ vi.advanceTimersToNextFrame();
+ });
+ act(() => {
+ result.current();
+ });
+ runFrames();
+ expect(politeText()).toBe('');
+ });
+
+ it('withdraws only its own busy start when another owner wrote the same words (AST-086 FR8, FR9)', () => {
+ const first = renderBusy();
+ const second = renderBusy();
+ // Both busy frames write "Loading" to the channel before it is exposed.
+ act(() => {
+ vi.advanceTimersToNextFrame();
+ });
+ // The first owner's search settles; the second is still busy.
+ act(() => {
+ first.result.current();
+ });
+ runFrames();
+ expect(politeText()).toBe('Loading');
+ second.unmount();
+ });
+
it('keeps a settled busy start dropped until the next busy start', () => {
const {result, rerender} = renderBusy();
act(() => {
diff --git a/packages/core/src/hooks/useBusyAnnouncement.ts b/packages/core/src/hooks/useBusyAnnouncement.ts
index 7db40c9df3..e63a592d8b 100644
--- a/packages/core/src/hooks/useBusyAnnouncement.ts
+++ b/packages/core/src/hooks/useBusyAnnouncement.ts
@@ -25,7 +25,11 @@
*/
import {useCallback, useEffect, useRef, type RefObject} from 'react';
-import {useAnnounce} from './useAnnounce';
+import {
+ takeJoinedAnnouncement,
+ useAnnounce,
+ withdrawPendingAnnouncement,
+} from './useAnnounce';
const REGION_ATTR = 'data-astryx-modal-busy-region';
const VISUALLY_HIDDEN_CSS =
@@ -79,9 +83,13 @@ export function useBusyAnnouncement(
const announce = useAnnounce();
const hasAnnouncedRef = useRef(false);
const frameRef = useRef<number | null>(null);
+ // This busy start's share of the shared channel's pending text, until it
+ // settles.
+ const channelMessageRef = useRef<object | null>(null);
useEffect(() => {
if (!isBusy) {
hasAnnouncedRef.current = false;
+ channelMessageRef.current = null;
return;
}
if (hasAnnouncedRef.current) {
@@ -97,6 +105,7 @@ export function useBusyAnnouncement(
announceInModal(dialog, message);
} else {
announce(message, 'polite');
+ channelMessageRef.current = takeJoinedAnnouncement();
}
});
frameRef.current = frame;
@@ -113,5 +122,10 @@ export function useBusyAnnouncement(
// Still busy until the settled state commits; do not schedule again.
hasAnnouncedRef.current = true;
}
+ // Written to the channel but not yet exposed: withdraw it too.
+ if (channelMessageRef.current != null) {
+ withdrawPendingAnnouncement(channelMessageRef.current, 'polite');
+ channelMessageRef.current = null;
+ }
}, []);
}
diff --git a/packages/lab/src/ListInput/ListInput.test.tsx b/packages/lab/src/ListInput/ListInput.test.tsx
index f358221a2a..2829fe8fd0 100644
--- a/packages/lab/src/ListInput/ListInput.test.tsx
+++ b/packages/lab/src/ListInput/ListInput.test.tsx
@@ -19,7 +19,7 @@ import {
waitFor,
within,
} from '@testing-library/react';
-import {useContainerReveal} from '@astryxdesign/core/hooks';
+import {useAnnounce, useContainerReveal} from '@astryxdesign/core/hooks';
import {TextInput} from '@astryxdesign/core/TextInput';
import {
ListInput,
@@ -206,6 +206,13 @@ function mockMutationAnimations(events: string[] = []) {
afterEach(() => {
vi.restoreAllMocks();
+ // The shared live regions outlive each test, and a test that stubs
+ // requestAnimationFrame can strand an announcement's frame. An empty
+ // announcement clears what is still waiting, so it is not joined into the
+ // next test's announcements (spec:AST-086 FR9).
+ const announcer = renderHook(() => useAnnounce());
+ announcer.result.current('');
+ announcer.unmount();
if (originalAnimateDescriptor == null) {
Reflect.deleteProperty(HTMLElement.prototype, 'animate');
} else {
@@ -1299,10 +1306,14 @@ describe('ListInput', () => {
fireEvent.pointerUp(handle, {pointerId: 9, clientX: 15, clientY: 10});
expect(onChange).not.toHaveBeenCalled();
+ // The grab and the return land in the same frame, so they are spoken
+ // together, in order (spec:AST-086 FR9).
await waitFor(() => {
expect(
Array.from(document.querySelectorAll('[aria-live="polite"]')).some(
- node => node.textContent === 'guest returned to position 1.',
+ node =>
+ node.textContent ===
+ 'guest 1 grabbed. Use arrow keys to move, Space or Enter to drop, and Escape to cancel. guest returned to position 1.',
),
).toBe(true);
});