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

@@ -82,7 +82,7 @@ type LooseRenderProps = {
// and (#628) the pencil re-edit affordance — so at most one dropdown is ever
// mounted (the AC-6 single-dropdown invariant). open() closes any prior
// dropdown first; render() is a thin adapter over open()/update()/close().
type OpenOptions = { focusOnMount?: boolean };
type OpenOptions = { focusOnMount?: boolean; editingDisplayName?: string };
type MentionController = {
open: (clientRect: RectGetter, query: string, commit: CommitFn, opts?: OpenOptions) => void;
@@ -183,6 +183,7 @@ function createMentionController(): MentionController {
model: dropdownState,
ondismiss: dismiss,
focusOnMount: opts.focusOnMount ?? false,
editingDisplayName: opts.editingDisplayName ?? '',
// MentionDropdown reads `editorQuery` off the shared state proxy via
// this getter — Svelte 5's mount() does not expose settable prop
// accessors, so we route through the proxy (same pattern as items).
@@ -235,7 +236,10 @@ function commitRelink(pos: number): CommitFn {
// the stored displayName.
function requestRelink(getRect: () => DOMRect | null, displayName: string, pos: number) {
if (!editor || !editor.isEditable) return;
controller.open(getRect, displayName, commitRelink(pos), { focusOnMount: true });
controller.open(getRect, displayName, commitRelink(pos), {
focusOnMount: true,
editingDisplayName: displayName
});
}
onMount(() => {