Prevent modifier key repeat from bogging down the app on WIndows

Closes #767
This commit is contained in:
Keavon Chambers 2022-11-20 14:02:59 -08:00
parent ccdfdd3015
commit 5bf7b9fdf8

View file

@ -99,6 +99,9 @@ export function createInputManager(editor: Editor, container: HTMLElement, dialo
async function onKeyDown(e: KeyboardEvent): Promise<void> {
const key = await getLocalizedScanCode(e);
const NO_KEY_REPEAT_MODIFIER_KEYS = ["ControlLeft", "ControlRight", "ShiftLeft", "ShiftRight", "MetaLeft", "MetaRight", "AltLeft", "AltRight", "AltGraph", "CapsLock", "Fn", "FnLock"];
if (e.repeat && NO_KEY_REPEAT_MODIFIER_KEYS.includes(key)) return;
if (await shouldRedirectKeyboardEventToBackend(e)) {
e.preventDefault();
const modifiers = makeKeyboardModifiersBitfield(e);