fix: better detect letter keys using KeyboardEvent.code

This commit is contained in:
Kha Nguyen 2025-07-22 19:10:35 -05:00
parent f3d5eb9d08
commit 771591bdfa
1 changed files with 6 additions and 2 deletions

View File

@ -217,8 +217,12 @@ function getPressedKey(ev: KeyboardEvent): string | null {
if (key === "backspace") return "backspace";
// Check letter keys
const isLetter = key.length === 1 && key >= "a" && key <= "z";
if (isLetter) return key;
if (code.startsWith("Key")) {
const letter = code.slice(3).toLowerCase();
if (letter.length === 1 && letter >= "a" && letter <= "z") {
return letter;
}
}
// Check number keys using physical position for AZERTY support
if (code.startsWith("Digit")) {