fix: prevent triggering Dead key in macOS

This commit is contained in:
purocean
2024-08-06 13:58:34 +08:00
parent f03d474e1e
commit e63f3af419
+8
View File
@@ -216,6 +216,14 @@ export function keydownHandler (e: KeyboardEvent) {
continue
}
// if user press `Option + E` in macOS, the `Dead` key will be triggered and insert `´`. so we need to blur and focus the input element to prevent this.s
if (isMacOS && e.key === 'Dead' && e.target && 'focus' in e.target && 'blur' in e.target) {
(e.target as any).blur()
setTimeout(() => {
(e.target as any).focus()
}, 0)
}
e.stopPropagation()
e.preventDefault()
getActionHandler(item.name)()