fix: ensure hotkeys.trigger() fires wildcard (*) registered handlers - #547
Merged
jaywcjlove merged 1 commit intoAug 28, 2026
Merged
Conversation
- Updated the trigger function in src/index.ts to also match item.shortcut === '*' when filtering handlers. - Added a test case in test/run.test.js to verify this behavior and prevent future regressions.
jaywcjlove
added a commit
that referenced
this pull request
Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes the issue where
hotkeys.trigger('key')does not invoke handlers registered with the*(wildcard) scope.Previously, the
triggerfunction only looked for exact key matches. This update ensures that when a key is triggered programmatically, it also executes the catch-all*handler, which is designed to match all key events.Changes
src/index.ts: Updated thetriggerfunction's filter condition to include|| item.shortcut === '*'.test/run.test.js: Added a comprehensive test case (Hotkey trigger should also fire wildcard (*) handlers) to verify that triggering a specific key fires both the specific handler and the wildcard handler, while triggering an unregistered key still fires the wildcard handler.Related Issue
Fixes #484