Skip to content

Commit

Permalink
fix: remove suggestions when clearing search field (#1817)
Browse files Browse the repository at this point in the history
* Update search.js

* Another take
  • Loading branch information
jokd authored Sep 22, 2023
1 parent d156d0e commit 11a5635
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/controls/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ const Search = function Search(options = {}) {
}

function clearSearchResults() {
awesomplete.list = [];
setSearchDb([]);
}

Expand Down Expand Up @@ -215,9 +214,7 @@ const Search = function Search(options = {}) {
});
document.getElementsByClassName('o-search-field')[0].addEventListener('focus', () => {
document.getElementById(`${wrapperElement.getId()}`).classList.add('active');
if (awesomplete.suggestions && awesomplete.suggestions.length > 0) {
awesomplete.open();
}
awesomplete.evaluate();
window.dispatchEvent(new CustomEvent('resize'));
});
}
Expand Down

0 comments on commit 11a5635

Please sign in to comment.