feat(keyboard-shortcuts): Adds support for any keyboard layout.

This commit is contained in:
damencho
2025-10-14 11:17:18 -05:00
committed by Дамян Минков
parent 641b52c51d
commit bf2254c753

View File

@@ -38,9 +38,10 @@ export const getKeyboardKey = (e: KeyboardEvent): string => {
// If alt is pressed a different char can be returned so this takes
// the char from the code. It also prefixes with a colon to differentiate
// alt combo from simple keypress.
if (altKey) {
const replacedKey = code.replace('Key', '');
const replacedKey = code.replace('Key', '');
if (altKey) {
return `:${replacedKey}`;
}
@@ -54,6 +55,10 @@ export const getKeyboardKey = (e: KeyboardEvent): string => {
return `-${key}`;
}
if (code.startsWith('Key')) {
return replacedKey;
}
return key;
}