allow shift+down in search box

This commit is contained in:
mat 2024-08-31 02:42:05 +00:00
parent 10fa3d82b9
commit 096ece1ff7

View File

@ -85,6 +85,11 @@ if (searchInputEl) {
} }
document.addEventListener("keydown", (e) => { document.addEventListener("keydown", (e) => {
// if any modifier keys are pressed, ignore all this
if (e.ctrlKey || e.metaKey || e.altKey || e.shiftKey) {
return;
}
// if it's focused then use different keybinds // if it's focused then use different keybinds
if (searchInputEl.matches(":focus")) { if (searchInputEl.matches(":focus")) {
if (e.key === "ArrowDown") { if (e.key === "ArrowDown") {
@ -122,10 +127,6 @@ if (searchInputEl) {
// if the user starts typing but they don't have focus on the input, focus it // if the user starts typing but they don't have focus on the input, focus it
// no modifier keys
if (e.ctrlKey || e.metaKey || e.altKey || e.shiftKey) {
return;
}
// must be a letter or number // must be a letter or number
if (e.key.match(/^[a-z0-9]$/i)) { if (e.key.match(/^[a-z0-9]$/i)) {
searchInputEl.focus(); searchInputEl.focus();