From f16bad666ab6f6546e6680d8adbbe52d6053b917 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mitja=20Bezen=C5=A1ek?= Date: Tue, 10 Oct 2023 13:22:36 +0200 Subject: [PATCH] Fix alt + shift keyboard shortcuts (#2053) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes keyboard shortcuts that use `alt + shift` modifier (distribute horizontally and vertically fall into this category). Fixes [#2054](https://github.com/tldraw/tldraw/issues/2054) ### Change Type - [x] `patch` — Bug fix ### Test Plan 1. Create multiple shapes 2. Use `alt + shift + v / h` to distribute vertically or horizontally. ### Release Notes - Fixes keyboard shortcuts that use `alt` and `shift` modifiers. --- packages/tldraw/src/lib/ui/hooks/useKeyboardShortcuts.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/tldraw/src/lib/ui/hooks/useKeyboardShortcuts.ts b/packages/tldraw/src/lib/ui/hooks/useKeyboardShortcuts.ts index efe6b9279..33d76da02 100644 --- a/packages/tldraw/src/lib/ui/hooks/useKeyboardShortcuts.ts +++ b/packages/tldraw/src/lib/ui/hooks/useKeyboardShortcuts.ts @@ -82,7 +82,11 @@ function getHotkeysStringFromKbd(kbd: string) { if (chars[0] === '!') { str = `shift+${chars[1]}` } else if (chars[0] === '?') { - str = `alt+${chars[1]}` + if (chars.length === 3 && chars[1] === '!') { + str = `alt+shift+${chars[2]}` + } else { + str = `alt+${chars[1]}` + } } else if (chars[0] === '$') { if (chars[1] === '!') { str = `cmd+shift+${chars[2]},ctrl+shift+${chars[2]}`