summaryrefslogtreecommitdiff
path: root/apps/web/src/stores
diff options
context:
space:
mode:
authorMaze Winther <mazewinther@gmail.com>2025-07-21 12:23:09 +0200
committerMaze Winther <mazewinther@gmail.com>2025-07-21 12:23:09 +0200
commitaeb9cfc6b8fa094cc538ef5c992a54236c25e180 (patch)
tree4c490ce236975a120cbff90a4c7bea7f2999a40d /apps/web/src/stores
parent4c2d8c52ab43837547e840ea4ed13b2c5d68d7e4 (diff)
downloadopencut-aeb9cfc6b8fa094cc538ef5c992a54236c25e180.tar.gz
fix: AZERTY support for keyboard shortcuts
Diffstat (limited to 'apps/web/src/stores')
-rw-r--r--apps/web/src/stores/keybindings-store.ts11
1 files changed, 10 insertions, 1 deletions
diff --git a/apps/web/src/stores/keybindings-store.ts b/apps/web/src/stores/keybindings-store.ts
index 60c71afd..3e525b86 100644
--- a/apps/web/src/stores/keybindings-store.ts
+++ b/apps/web/src/stores/keybindings-store.ts
@@ -195,6 +195,7 @@ function generateKeybindingString(ev: KeyboardEvent): ShortcutKey | null {
function getPressedKey(ev: KeyboardEvent): string | null {
// Sometimes the property code is not available on the KeyboardEvent object
const key = (ev.key ?? "").toLowerCase();
+ const code = ev.code ?? "";
// Check arrow keys
if (key.startsWith("arrow")) {
@@ -213,7 +214,15 @@ function getPressedKey(ev: KeyboardEvent): string | null {
const isLetter = key.length === 1 && key >= "a" && key <= "z";
if (isLetter) return key;
- // Check if number keys
+ // Check number keys using physical position for AZERTY support
+ if (code.startsWith("Digit")) {
+ const digit = code.slice(5);
+ if (digit.length === 1 && digit >= "0" && digit <= "9") {
+ return digit;
+ }
+ }
+
+ // Fallback for other layouts
const isDigit = key.length === 1 && key >= "0" && key <= "9";
if (isDigit) return key;