github / hotkey

Trigger an action on an element with a keyboard shortcut.
https://github.github.com/hotkey/
MIT License
3.22k stars 97 forks source link

Allow scoped elements to share the same hotkeys #51

Closed khiga8 closed 3 years ago

khiga8 commented 3 years ago

Currently @github/hotkey will always return the last registered element when multiple elements are registered with the same hotkey. (See corresponding test)

This PR changes this behavior for scoped hotkeys which were introduced in https://github.com/github/hotkey/pull/49.

When the same hotkey is registered to multiple scoped elements, we can trigger the specific element that matches the criteria.