Open drubb opened 8 years ago
Just found out that this doesn't work in conjunction with alert
. If I replace this by console.log
, everything is fine, the default event won't be triggered. The default code without parameters is ok, too:
var listener = new window.keypress.Listener();
listener.simple_combo("ctrl o", function() {
console.log("You pressed ctrl and o");
});
So maybe this is a special case.
So all combos will prevent the default behaviors by default (the prevent_default is for all constituent keys). It looks like the browser is doing some magic and doesn't like that the JS is throwing an alert maybe? What browser is this in?
Firefox 47.0.1 (Windows)
I'm not sure how to prevent the default handling for key pressures, at least it doesn't work for me. I've tried to figure this out from the docs, and ended up with the following code (example):
This will display the message, however the browser's default behaviour (open a file dialog) is triggered, too. Same for e.g. ctrl+f (opens find dialog).
Thanks a lot, Boris