Fix autocomplete behavior on result page

Similar issue to #629, but the result page uses a different script for
handling user input, so the fix was not applied appropriately.

It has been fixed for this view now.
pull/781/head
Ben Busby 2 years ago
parent 65796fd1a5
commit 35ac5ac82f
No known key found for this signature in database
GPG Key ID: B9B7231E01D924A1

@ -1,11 +1,14 @@
document.addEventListener("DOMContentLoaded", () => {
const searchBar = document.getElementById("search-bar");
const arrowKeys = [37, 38, 39, 40];
let searchValue = searchBar.value;
searchBar.addEventListener("keyup", function (event) {
if (event.keyCode !== 13) {
handleUserInput(searchBar);
} else {
searchBar.addEventListener("keyup", function(event) {
if (event.keyCode === 13) {
document.getElementById("search-form").submit();
} else if (searchBar.value !== searchValue && !arrowKeys.includes(event.keyCode)) {
searchValue = searchBar.value;
handleUserInput();
}
});
});

Loading…
Cancel
Save