chieffancypants / angular-hotkeys

Configuration-centric keyboard shortcuts for your Angular apps.
http://chieffancypants.github.io/angular-hotkeys/
MIT License
1.68k stars 254 forks source link

Fix for Mousetrap to prevent event propagation. #249

Open destradax opened 7 years ago

destradax commented 7 years ago

I noticed that when you add combos like Ctrl + a (which is used by some browsers to select everything in the page), the hotkey callback is fired successfully but the event is not cancelled and hence the default action of the combo is executed (Select All in this case)

aramando commented 7 years ago

I'd argue this is best left for the user of the library to decide. I always call event.preventDefault() as the first line of all my hotkey callbacks, but it is conceivable that someone might want to augment the default action of a hotkey combo rather than replace it.