diff --git a/assets/js/autocomplete.ts b/assets/js/autocomplete.ts index 12a19e55..f027e0d2 100644 --- a/assets/js/autocomplete.ts +++ b/assets/js/autocomplete.ts @@ -44,11 +44,13 @@ function applySelectedValue(selection: string) { if (!inputField) return; if (!isSearchField(inputField)) { + let resultValue = selection; + if (originalTerm?.startsWith('-')) { - selection = `-${selection}`; + resultValue = `-${selection}`; } - inputField.value = selection; + inputField.value = resultValue; return; }