Skip to content

fix: ensure hotkeys.trigger() fires wildcard (*) registered handlers - #547

Merged
jaywcjlove merged 1 commit into
jaywcjlove:masterfrom
homayounmmdy:fix/trigger-wildcard-handler
Aug 28, 2026
Merged

fix: ensure hotkeys.trigger() fires wildcard (*) registered handlers#547
jaywcjlove merged 1 commit into
jaywcjlove:masterfrom
homayounmmdy:fix/trigger-wildcard-handler

Conversation

@homayounmmdy

Copy link
Copy Markdown
Contributor

This PR fixes the issue where hotkeys.trigger('key') does not invoke handlers registered with the * (wildcard) scope.

Previously, the trigger function 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 the trigger function'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

- 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
jaywcjlove merged commit 35e00c9 into jaywcjlove:master Aug 28, 2026
1 check passed
github-actions Bot pushed a commit that referenced this pull request Aug 28, 2026
…ndlers (#547)

- 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. 35e00c9
jaywcjlove added a commit that referenced this pull request Aug 28, 2026
github-actions Bot pushed a commit that referenced this pull request Aug 28, 2026
@homayounmmdy
homayounmmdy deleted the fix/trigger-wildcard-handler branch August 28, 2026 07:46
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.

Unable to capture ?

2 participants