From fe37e2a8236b977ca10a46665593cf79ab45518b Mon Sep 17 00:00:00 2001 From: Will Hinz Date: Tue, 24 Mar 2026 22:57:46 -0700 Subject: [PATCH] fix: resolve [bug][alpha] which key (`whichkey`): `keydown` with `repeat === true` extends the pending chord and can cancel the sequence Signed-off-by: hinzwilliam52-ship-it --- FIX_PROPOSAL.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 FIX_PROPOSAL.md diff --git a/FIX_PROPOSAL.md b/FIX_PROPOSAL.md new file mode 100644 index 0000000..63706d7 --- /dev/null +++ b/FIX_PROPOSAL.md @@ -0,0 +1,15 @@ +To fix the issue, you need to add a check for `event.repeat` in the `keydown` event listener. If `event.repeat` is `true`, you should ignore the event and not append the keystroke to the sequence. + +Here is the exact code fix: + +```typescript +// In WhichKeyContext.tsx +window.addEventListener('keydown', (event) => { + // ... + if (event.repeat) return; // Add this line to ignore repeat events + const newPrefix = [...currentSequence.keystrokes, keystroke]; + // ... +}); +``` + +This will prevent the repeat events from appending to the sequence and canceling the chord. Instead, the sequence will remain open for the next deliberate key press. \ No newline at end of file