You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: handle dead keys in matchesKeyboardEvent (#40)
* fix: handle dead keys in matchesKeyboardEvent
When event.key is 'Dead' (length 4), the existing event.code fallback
(gated behind eventKey.length === 1) was never reached, causing hotkeys
to silently fail.
This most commonly affects macOS, where Option+letter combinations like
Option+E, Option+I, Option+U, and Option+N produce dead keys for accent
composition. It also affects Windows and Linux users with international
keyboard layouts (e.g., US-International, German, French) where certain
key combinations produce dead keys.
Adds an early check: when event.key normalizes to 'Dead', immediately
fall back to event.code to extract the physical key via the Key*/Digit*
prefixes. Punctuation dead keys (e.g., apostrophe on US-International,
where event.code is 'Quote') correctly return false since their codes
don't match letter or digit patterns.
Includes 10 tests covering dead key scenarios for letter keys, digit
keys, modifier combinations, mismatches, and missing/invalid codes.
Co-authored-by: Cursor <cursoragent@cursor.com>
* ci: apply automated fixes
* refactor: deduplicate event.code fallback for dead keys and single-char mismatches
Address review feedback by consolidating the dead key handler and the
existing single-character event.code fallback into a single code path.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* ci: apply automated fixes
* eslint ignore for event.code null
* ci: apply automated fixes
---------
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Kevin Van Cott <kevinvandy656@gmail.com>
When `event.key` is `'Dead'` (length 4), the existing `event.code` fallback—gated behind `eventKey.length === 1`—was never reached, causing hotkeys to silently fail.
8
+
9
+
This most commonly affects macOS, where `Option+letter` combinations like `Option+E`, `Option+I`, `Option+U`, and `Option+N` produce dead keys for accent composition. It also affects Windows and Linux users with international keyboard layouts (e.g., US-International, German, French) where certain key combinations produce dead keys.
10
+
11
+
Added an early check: when `event.key` normalizes to `'Dead'`, immediately fall back to `event.code` to extract the physical key via the `Key*`/`Digit*` prefixes. Punctuation dead keys (e.g., `'` on US-International, where `event.code` is `'Quote'`) correctly return `false` since their codes don't match letter or digit patterns.
0 commit comments