Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple the same combo #104

Open
piernik opened this issue Apr 3, 2019 · 1 comment
Open

Multiple the same combo #104

piernik opened this issue Apr 3, 2019 · 1 comment

Comments

@piernik
Copy link

piernik commented Apr 3, 2019

In my app I can open multiple modals. I want to close them with esc key.
So in every modal I'm adding combo with this.hotkeysService.add() which returns HotKey | Hotkey [].
But when in second modal I'm removing combo with this.hotkeysService.remove(hotKey) using hotKey instance created in second modal it removes all esc instances and esc key does not work with first modal.

@wittlock
Copy link
Collaborator

wittlock commented Apr 7, 2019

I think the easiest way to solve this is to just add the one hotkey for esc that will call a method in a service you've created and this service keeps track of any open modals and close them when it's pressed. That way you don't need to keep adding/removing the hotkey in this module.

I'll try to keep this in mind for if I try to rebuild how the remove-method works, but I doubt that will happen anytime soon, so I suggest going with the workaround mentioned above instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants