From 79bd3b8cdafa7bb1cdfddcc8182e1a72aba1b3f6 Mon Sep 17 00:00:00 2001 From: Jakob Guddas Date: Thu, 20 Oct 2022 21:01:26 +0200 Subject: [PATCH] fix: replaced KeyboardEvent.code with KeyboardEvent.key for all letters (#5523) * fix: Replaced KeyboardEvent.code with KeyboardEvent.key for all letters * fix: reverted all keybindings that included alt to use code instead of keys Co-authored-by: Aakansha Doshi --- src/actions/actionClipboard.tsx | 2 +- src/actions/actionGroup.tsx | 6 +++--- src/actions/actionMenu.tsx | 4 ++-- src/keys.ts | 6 +++--- src/tests/contextmenu.test.tsx | 6 +++--- src/tests/helpers/ui.ts | 4 ++-- src/tests/regressionTests.test.tsx | 14 +++++++------- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/actions/actionClipboard.tsx b/src/actions/actionClipboard.tsx index 4ca25c3f..62a89a38 100644 --- a/src/actions/actionClipboard.tsx +++ b/src/actions/actionClipboard.tsx @@ -36,7 +36,7 @@ export const actionCut = register({ return actionDeleteSelected.perform(elements, appState); }, contextItemLabel: "labels.cut", - keyTest: (event) => event[KEYS.CTRL_OR_CMD] && event.code === CODES.X, + keyTest: (event) => event[KEYS.CTRL_OR_CMD] && event.key === KEYS.X, }); export const actionCopyAsSvg = register({ diff --git a/src/actions/actionGroup.tsx b/src/actions/actionGroup.tsx index 1d4b4518..243247ef 100644 --- a/src/actions/actionGroup.tsx +++ b/src/actions/actionGroup.tsx @@ -1,4 +1,4 @@ -import { CODES, KEYS } from "../keys"; +import { KEYS } from "../keys"; import { t } from "../i18n"; import { arrayToMap, getShortcutKey } from "../utils"; import { register } from "./register"; @@ -132,7 +132,7 @@ export const actionGroup = register({ contextItemPredicate: (elements, appState) => enableActionGroup(elements, appState), keyTest: (event) => - !event.shiftKey && event[KEYS.CTRL_OR_CMD] && event.code === CODES.G, + !event.shiftKey && event[KEYS.CTRL_OR_CMD] && event.key === KEYS.G, PanelComponent: ({ elements, appState, updateData }) => (