don't focus input on ctrl key
This commit is contained in:
parent
03d74ddac8
commit
4bf4b1e69b
@ -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
|
// if the user starts typing but they don't have focus on the input, focus it
|
||||||
document.addEventListener("keydown", (e) => {
|
document.addEventListener("keydown", (e) => {
|
||||||
// must be a letter or number
|
// 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();
|
searchInputEl.focus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user