don't focus input on ctrl key

This commit is contained in:
mat 2023-12-20 23:48:28 -06:00
parent 03d74ddac8
commit 4bf4b1e69b

View File

@ -26,7 +26,12 @@ searchInputEl.addEventListener("input", async (e) => {
// if the user starts typing but they don't have focus on the input, focus it
document.addEventListener("keydown", (e) => {
// must be a letter or number
if (e.key.match(/^[a-z0-9]$/i) && !searchInputEl.matches(":focus")) {
if (
e.key.match(/^[a-z0-9]$/i) &&
!searchInputEl.matches(":focus") &&
!e.ctrlKey &&
!e.metaKey
) {
searchInputEl.focus();
}
});