Choose how you handle multiple bindings for the same shortcut
Grasscropper opened this issue · comments
First of all, great library! Sababa ;) ! I changed from another one I was using and I'm glad I did, so thanks for that.
So I my suggestion is that you can set the way you handle multiple bindings for the same shortcut. I basically see it as handling it in the following 3 ways when the shortcut is used:
1. Trigger all of the commands/bindings
2. Trigger the first one added
3. Trigger the last one added
Let me explain my usecase. I have a card component (kind of like a popup) that can be closed with escape. It is possible for multiple cards to be opened in a stack on top of eachother. In my usecase I would want to use option 3 because I want the last opened card to be closed with escape. Then when that is closed I want escape to close the next card and so on.
So yeah that's the suggestion, let me know what you think.
p.s. A slightly separate issue/wish I have is that the closeKey shortcut does not get "occupied" when the help menu is not open. I find it natural for it to be the escape key but I also want to use escape elsewhere in the app.
Toda raba!
@Grasscropper
Very happy to hear your feedback and that you love the library :)
- I have a branch to add support for multiple bindings for the same key, but I have some issues on making it work with Debounce and since I don't want to break the existing API, until I find a way to make it work with debounce and multiple binding, I don't want to release it.
- Would you mind opening a new issue for that and i'll try to handle it, currently , not sure that I will be able to as until I add support for the feature you requested, this won't be possible (if you already have shortcut assigned to escape).
I'll try to think of a way to handle it.