summaryrefslogtreecommitdiff
path: root/packages/frontend/src/scripts/hotkey.ts
diff options
context:
space:
mode:
authorKagami Sascha Rosylight <saschanaz@outlook.com>2023-03-01 07:24:09 +0100
committerGitHub <noreply@github.com>2023-03-01 15:24:09 +0900
commit6d82371449cc97f1ee8a7425b17ec536a3095640 (patch)
tree199afc9df4d21d20ab5e780b46a42a8d89a006bc /packages/frontend/src/scripts/hotkey.ts
parentrefactor: plugin.tsの型を修正する (#10027) (diff)
downloadmisskey-6d82371449cc97f1ee8a7425b17ec536a3095640.tar.gz
misskey-6d82371449cc97f1ee8a7425b17ec536a3095640.tar.bz2
misskey-6d82371449cc97f1ee8a7425b17ec536a3095640.zip
fix(frontend): read KeyboardEvent.key instead of which/code (#10083)
Diffstat (limited to 'packages/frontend/src/scripts/hotkey.ts')
-rw-r--r--packages/frontend/src/scripts/hotkey.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/packages/frontend/src/scripts/hotkey.ts b/packages/frontend/src/scripts/hotkey.ts
index 4a0ded637d..b7238016c6 100644
--- a/packages/frontend/src/scripts/hotkey.ts
+++ b/packages/frontend/src/scripts/hotkey.ts
@@ -53,10 +53,10 @@ const parseKeymap = (keymap: Keymap) => Object.entries(keymap).map(([patterns, c
return result;
});
-const ignoreElemens = ['input', 'textarea'];
+const ignoreElements = ['input', 'textarea'];
function match(ev: KeyboardEvent, patterns: Action['patterns']): boolean {
- const key = ev.code.toLowerCase();
+ const key = ev.key.toLowerCase();
return patterns.some(pattern => pattern.which.includes(key) &&
pattern.ctrl === ev.ctrlKey &&
pattern.shift === ev.shiftKey &&
@@ -70,7 +70,7 @@ export const makeHotkey = (keymap: Keymap) => {
return (ev: KeyboardEvent) => {
if (document.activeElement) {
- if (ignoreElemens.some(el => document.activeElement!.matches(el))) return;
+ if (ignoreElements.some(el => document.activeElement!.matches(el))) return;
if (document.activeElement.attributes['contenteditable']) return;
}