fix: dead key issue in mac (#3058)

This commit is contained in:
Anwarul Islam
2023-05-24 02:41:37 +06:00
committed by GitHub
parent e77eef1532
commit 9dbdef9286

View File

@@ -121,8 +121,8 @@ function getPressedKey(ev: KeyboardEvent): Key | null {
else if (val === "arrowright") return "right"
// Check letter keys
if (val.length === 1 && val.toUpperCase() !== val.toLowerCase())
return val as Key
const isLetter = ev.code.toLowerCase().startsWith("key")
if (isLetter) return ev.code.toLowerCase().substring(3) as Key
// Check if number keys
if (val.length === 1 && !isNaN(val as any)) return val as Key