Skip to content

Commit

Permalink
Call custom ordering functions when opening the menu with an empty input
Browse files Browse the repository at this point in the history
This is useful in cases one want to suggest items when the input is
focused, before any input has been written. In such a case we want to
call processListItems to sort the suggested items.
  • Loading branch information
azmeuk committed Feb 23, 2023
1 parent 0f59818 commit 732a39e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/SimpleAutocomplete.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@
return numberOfMatches(obj2, searchWords) - numberOfMatches(obj1, searchWords)
}
function processListItems(textFiltered) {
function processListItems(textFiltered="") {
// cleans, filters, orders, and highlights the list items
prepareListItems()
Expand Down Expand Up @@ -871,7 +871,7 @@
if (searchFunction && !listItems.length) {
search()
} else if (!text) {
filteredListItems = listItems
processListItems()
}
open()
Expand Down

0 comments on commit 732a39e

Please sign in to comment.