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
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):
var scope = document.getElementById("page");
var options = {
prevent_default : true
};
var listener = new window.keypress.Listener(scope, options);
listener.simple_combo("ctrl o", function() {
alert("You pressed ctrl and o");
});
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
The text was updated successfully, but these errors were encountered:
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 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?
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
The text was updated successfully, but these errors were encountered: