You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:
Current behavior
If a duplicate shortcut is registered, the library logs an error to the console and resolves with an observable holding null (https://github.com/ngneat/hotkeys/blob/master/projects/ngneat/hotkeys/src/lib/hotkeys.service.ts#L160). This leads to unexpected behaviour, because the callback to execute when the shortcut has been pressed, is still executed but the event is null. This becomes especially confusing, because of the of(null) the callback is immediately executed, even if the key has not been pressed.
Expected behavior
The observable should error, if an error occurs, thus not executing the callback.
Minimal reproduction of the problem with instructions
Just register a callback twice.
Environment
Angular version: 15.x
Browser:
- [x] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
The text was updated successfully, but these errors were encountered:
I'm submitting a...
Current behavior
If a duplicate shortcut is registered, the library logs an error to the console and resolves with an observable holding
null
(https://github.com/ngneat/hotkeys/blob/master/projects/ngneat/hotkeys/src/lib/hotkeys.service.ts#L160). This leads to unexpected behaviour, because the callback to execute when the shortcut has been pressed, is still executed but the event is null. This becomes especially confusing, because of theof(null)
the callback is immediately executed, even if the key has not been pressed.Expected behavior
The observable should error, if an error occurs, thus not executing the callback.
Minimal reproduction of the problem with instructions
Just register a callback twice.
Environment
The text was updated successfully, but these errors were encountered: