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:
@@ -33,7 +33,8 @@ let {
|
||||
editorQuery = '',
|
||||
onSearch = () => {},
|
||||
ondismiss = () => {},
|
||||
focusOnMount = false
|
||||
focusOnMount = false,
|
||||
editingDisplayName = ''
|
||||
}: {
|
||||
model: DropdownState;
|
||||
/** Text typed after `@` in the host editor. Mirrors into the search input
|
||||
@@ -46,6 +47,10 @@ let {
|
||||
/** Re-edit (#628) opens with the search field focused; the fresh-@ path keeps
|
||||
* focus in the editor so typing flows to the contenteditable. */
|
||||
focusOnMount?: boolean;
|
||||
/** When set (re-edit, #628), the persistent live region announces the editing
|
||||
* context for this mention. Routed through the SAME aria-live region as the
|
||||
* result count — never a second live region (avoids the double-announce bug). */
|
||||
editingDisplayName?: string;
|
||||
} = $props();
|
||||
|
||||
let searchQuery = $state(untrack(() => editorQuery.slice(0, MAX_QUERY_LENGTH)));
|
||||
@@ -260,7 +265,11 @@ function selectItem(item: Person) {
|
||||
-->
|
||||
<p class="sr-only" aria-live="polite">
|
||||
{#if model.items.length === 0}
|
||||
{isQueryEmpty ? m.person_mention_search_prompt() : m.person_mention_popup_empty()}
|
||||
{#if editingDisplayName && !userHasEdited}
|
||||
{m.person_mention_editing_announce({ displayName: editingDisplayName })}
|
||||
{:else}
|
||||
{isQueryEmpty ? m.person_mention_search_prompt() : m.person_mention_popup_empty()}
|
||||
{/if}
|
||||
{:else if model.items.length === 1}
|
||||
{m.person_mention_results_count_singular()}
|
||||
{:else}
|
||||
|
||||
Reference in New Issue
Block a user