diff --git a/frontend/src/lib/shared/discussion/MentionDropdown.svelte b/frontend/src/lib/shared/discussion/MentionDropdown.svelte index b0d1202a..c647f434 100644 --- a/frontend/src/lib/shared/discussion/MentionDropdown.svelte +++ b/frontend/src/lib/shared/discussion/MentionDropdown.svelte @@ -43,6 +43,11 @@ let { let searchQuery = $state(untrack(() => editorQuery.slice(0, MAX_QUERY_LENGTH))); let userHasEdited = $state(false); +// Intent-revealing alias used by both the persistent aria-live announcer and +// the visible empty-state copy. Folding the duplicated rule into one $derived +// keeps the two branches in lockstep. Felix #3 on PR #629 round 4. +const isQueryEmpty = $derived(searchQuery.trim() === ''); + // Mirror the editor's typed text until the user takes ownership. // // Why `$state + $effect` (not `$derived`): `searchQuery` is also written by @@ -203,9 +208,7 @@ function selectItem(item: Person) { -->

{#if model.items.length === 0} - {searchQuery.trim() === '' - ? m.person_mention_search_prompt() - : m.person_mention_popup_empty()} + {isQueryEmpty ? m.person_mention_search_prompt() : m.person_mention_popup_empty()} {:else if model.items.length === 1} {m.person_mention_results_count_singular()} {:else} @@ -215,12 +218,14 @@ function selectItem(item: Person) { {#if model.items.length === 0} -

- {searchQuery.trim() === '' - ? m.person_mention_search_prompt() - : m.person_mention_popup_empty()} +