react-hotkeys-hook
react-hotkeys-hook copied to clipboard
Feature: Add support for event capturing
This small change adds a new capture option to the useHotkeys hook. It determines whether key events will be triggered in the capturing or bubbling phase (default) during event propogation. More info here.
I've found this to be useful when setting up global hotkeys within an application where you may wish to override any child elements that stopPropagation().
I've added a test to verify this new behaviour along with documentation of the new option, please let me know If you'd like me to make any further changes.
Thanks for this awesome library.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| react-hotkeys-hook | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Oct 1, 2024 10:04am |
@ollieri3 First of all sorry for the long wait! Second: Thank you so much for your contribution, it's an interesting new feature. Could you add info to the documentation pages as well? And I think you need to update your branch to reflect the latest changes on the main branch, then I'll merge it.
I'm interested in this change as well for my use case, so thanks for putting up this PR. I noticed there hasn't been any activity in the past two months. @ollieri3 are you planning on adding the documentation here? I can try to help out with that (though not sure what the best way to do that would be).
@ollieri3 This has to be updated to comply with version 5.
Will this ever be merged? It's a very nice feature to have.
@Aspecky You can use the eventListenerOptions options object and set capture: true