Skip to content

Commit

Permalink
Move selection to end of the selected term instead of the end of query
Browse files Browse the repository at this point in the history
  • Loading branch information
koloml committed Nov 14, 2024
1 parent 0523c0f commit 8e742b2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions assets/js/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ function restoreOriginalValue() {

if (isSearchField(inputField) && originalQuery) {
inputField.value = originalQuery;

if (selectedTerm) {
const [, selectedTermEnd] = selectedTerm[0];

inputField.setSelectionRange(selectedTermEnd, selectedTermEnd);
}

return;
}

Expand Down

0 comments on commit 8e742b2

Please sign in to comment.