feat(transcription): announce re-edit context via the existing live region (#628)

Passes editingDisplayName into MentionDropdown; the persistent aria-live region
announces person_mention_editing_announce({displayName}) on re-edit open and
falls back to the prompt/empty/count copy once the user edits or results arrive.
Routed through the SAME sr-only region as the result count — no second live
region (avoids the double-announce bug Leonie S-2 fixed). Fresh-@ passes an
empty editingDisplayName, so its announcements are unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-06-02 19:49:36 +02:00
committed by marcel
parent 751a48b22c
commit 9bba5e4a7a
3 changed files with 41 additions and 4 deletions

View File

@@ -1309,3 +1309,27 @@ describe('PersonMentionEditor — #628 security', () => {
});
});
});
// ─── #628 NFR a11y: editing context announced via the existing live region ───
describe('PersonMentionEditor — #628 editing announce', () => {
it('re-edit open announces the editing context through the single persistent live region', async () => {
mockFetchEmpty();
renderHost({ value: '@Aug ', mentionedPersons: [{ personId: 'p-aug', displayName: 'Aug' }] });
await vi.waitFor(() =>
expect(document.querySelector('[data-type="mention"] button')).not.toBeNull()
);
(document.querySelector('[data-type="mention"] button') as HTMLElement).dispatchEvent(
new MouseEvent('click', { bubbles: true, cancelable: true })
);
await vi.waitFor(() => {
const liveRegions = document.querySelectorAll('[role="listbox"] [aria-live="polite"]');
// Exactly ONE live region (no second announcer — avoids double-announce).
expect(liveRegions.length).toBe(1);
expect(liveRegions[0].textContent ?? '').toContain(
m.person_mention_editing_announce({ displayName: 'Aug' })
);
});
});
});