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.main
parent
65796fd1a5
commit
35ac5ac82f
|
@ -1,11 +1,14 @@
|
||||||
document.addEventListener("DOMContentLoaded", () => {
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
const searchBar = document.getElementById("search-bar");
|
const searchBar = document.getElementById("search-bar");
|
||||||
|
const arrowKeys = [37, 38, 39, 40];
|
||||||
|
let searchValue = searchBar.value;
|
||||||
|
|
||||||
searchBar.addEventListener("keyup", function (event) {
|
searchBar.addEventListener("keyup", function(event) {
|
||||||
if (event.keyCode !== 13) {
|
if (event.keyCode === 13) {
|
||||||
handleUserInput(searchBar);
|
|
||||||
} else {
|
|
||||||
document.getElementById("search-form").submit();
|
document.getElementById("search-form").submit();
|
||||||
|
} else if (searchBar.value !== searchValue && !arrowKeys.includes(event.keyCode)) {
|
||||||
|
searchValue = searchBar.value;
|
||||||
|
handleUserInput();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue