keybinds - prevent triggering when holding shift, alt, ctrl or meta key

This commit is contained in:
Flummi 2022-05-09 12:59:33 +02:00
parent e7ee063021
commit 8f5680e50f

View File

@ -29,6 +29,8 @@
};
document.addEventListener("keydown", e => {
if(e.key in keybindings && e.target.tagName !== "INPUT") {
if(e.shiftKey || e.ctrlKey || e.metaKey || e.altKey)
return;
e.preventDefault();
keybindings[e.key]();
}