Skip to content

Modern Docker Management, Designed for Everyone

fix: keyboard shortcuts dont work for non qwerty layouts (#1624)

Kyle Mendell19a0825be9c5
diff --git a/frontend/src/lib/utils/keyboard-shortcut.utils.ts b/frontend/src/lib/utils/keyboard-shortcut.utils.ts
index 6f4033339..ef588c1d0 100644
--- a/frontend/src/lib/utils/keyboard-shortcut.utils.ts
+++ b/frontend/src/lib/utils/keyboard-shortcut.utils.ts
@@ -41,6 +41,11 @@ export function matchesShortcutEvent(keys: ShortcutKey[], event: KeyboardEvent,
const key = event.key.toLowerCase();
if (MODIFIER_KEYS.has(key)) return false;
+ const expectedCode = getExpectedCode(nonModifierKeys[0]);
+ if (expectedCode) {
+ return event.code.toLowerCase() === expectedCode;
+ }
+
return key === nonModifierKeys[0];
}
@@ -68,3 +73,13 @@ function formatShortcutKey(key: ShortcutKey, isMac: boolean): string {
return key.length === 1 ? key.toUpperCase() : key;
}
}
+
+function getExpectedCode(key: string): string | null {
+ if (/^[0-9]$/.test(key)) {
+ return `digit${key}`;
+ }
+ if (/^[a-z]$/.test(key)) {
+ return `key${key}`;
+ }
+ return null;
+}