fix for 's' keypress in search, and escape behaviour to reset sidebar elements

This commit is contained in:
Luke Boswell 2022-10-09 20:42:19 +11:00
parent 34f56371f7
commit 17aac69d92
No known key found for this signature in database
GPG key ID: 0E908525B2C7BD68

View file

@ -47,7 +47,7 @@
// Capture '/' keypress for quick search
window.addEventListener("keyup", (e) => {
if (e.key === "s") {
if (e.key === "s" && document.activeElement !== searchBox) {
e.preventDefault;
searchBox.focus();
searchBox.value = "";
@ -55,7 +55,13 @@
if (e.key === "Escape" && document.activeElement === searchBox) {
e.preventDefault;
// De-focus input box
searchBox.blur();
// Reset sidebar state
search();
}
});