test(web): preserve editing focus during recovery feedback

Existing coverage checks focus after Clear but not when asynchronous failure feedback arrives. Guard input focus, unfinished text and mounted live-region identity without changing the interface or claiming screen-reader acceptance.

Change-source: pulse-maintainer
This commit is contained in:
pulse-triage[bot]
2026-09-07 18:06:54 +01:00
parent 3c77ecb338
commit 800663fdf3
@@ -219,6 +219,29 @@ describe('AlertDeliveryHealthCard', () => {
describe('recovery feedback beside delivery health', () => {
afterEach(() => cleanup());
it('preserves editing focus and live-region identity when failure feedback changes', () => {
const [message, setMessage] = createSignal<string | null>(null);
render(() => <>
<input aria-label="Destination name" />
<AlertQueueActionFeedback message={message()} onClear={() => setMessage(null)} />
</>);
const input = screen.getByRole('textbox', { name: 'Destination name' });
const status = screen.getByRole('status');
expect(status).toHaveAttribute('aria-live', 'polite');
expect(status).toHaveAttribute('aria-atomic', 'true');
input.focus();
fireEvent.input(input, { target: { value: 'Unfinished edit' } });
for (const failure of [
'Unable to retry retained notification deliveries.',
'Unable to dismiss retained notification failures.',
]) {
setMessage(failure);
expect(screen.getByRole('status')).toBe(status);
expect(status).toHaveTextContent(failure);
expect(input).toHaveFocus();
expect(input).toHaveValue('Unfinished edit');
}
});
it('keeps a mounted live region and returns focus to it when deliberately cleared', () => {
const [message, setMessage] = createSignal<string | null>(null);
render(() => <AlertQueueActionFeedback message={message()} onClear={() => setMessage(null)} />);