Skip to content

fix: prevent code-based fallback when useKey is true#3

Merged
K-Mistele merged 3 commits intomainfrom
publish-humanlayer
Mar 27, 2026
Merged

fix: prevent code-based fallback when useKey is true#3
K-Mistele merged 3 commits intomainfrom
publish-humanlayer

Conversation

@K-Mistele
Copy link
Copy Markdown

Summary

  • When useKey: true, the validator now ONLY matches produced keys (event.key) and never falls through to code-based matching (event.code)
  • Previously, if the produced key didn't match, the code-based check would still fire — causing hotkeys to trigger based on physical key position even with useKey: true
  • This broke non-QWERTY layouts (Dvorak, AZERTY, Colemak) where a single keypress would trigger both the produced-character hotkey AND the physical-key-code hotkey

Test plan

  • All 145 existing tests pass
  • On Dvorak: pressing physical 'c' (produces 'j') should only trigger 'j' hotkey, not 'c'

🤖 Generated with Claude Code

K-Mistele and others added 3 commits March 20, 2026 10:48
When useKey is true, the validator should ONLY match against the
produced key (event.key), never fall through to code-based matching
(event.code). Previously, if the produced key didn't match, the
code-based check would still fire — causing hotkeys to trigger based
on physical key position even with useKey: true.

This broke non-QWERTY layouts (Dvorak, AZERTY, Colemak) where a
single keypress would trigger both the produced-character hotkey
AND the physical-key-code hotkey.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Version Bump Summary

Package: @humanlayer/react-hotkeys-hook
Action: bumped to 5.2.6
Reasoning: The change is a pure bug fix — when useKey: true, the validator now exclusively matches against event.key (produced key) without falling through to code-based matching. This corrects broken behavior on non-QWERTY layouts but adds no new API surface and breaks no existing contracts. Patch bump is appropriate.

@K-Mistele K-Mistele merged commit 1994b7f into main Mar 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants