Improve focus on reload, back, etc

This commit is contained in:
Daoud Clarke 2021-12-20 23:15:42 +00:00
parent 202ef35d7a
commit 8f8fc43c9f

View file

@ -39,17 +39,21 @@ window.onload = (event) => {
} else if (e.key == 'ArrowUp') {
selectPreviousItem();
} else if (e.key == 'Enter') {
clickSelected();
}
// const form = document.getElementById('search-form');
// form.submit();
// event.preventDefault();
}
});
// Handle pressing enter
const form = document.getElementById('search-form');
form.addEventListener( "submit", event => {
form.addEventListener("submit", event => {
event.preventDefault();
clickSelected();
});
searchInput.focus();
};