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
My browser, when I start typing into something that is not an entry field (such as the canvas here), it opens a search bar, which then takes focus. This is not desirable when interacting with, say, a game.
I expect there to be similar situations in other environments, where a key press, which is meant to be handled by the application, has other unwanted effects.
The solutions is to call e.preventDefault() in Trigger. But this would disable all keyboard interaction, which is probably not what we want either (e.g. Ctrl-R is very useful).
So I propose to leave every Ctrl-Key-Combo to the browser, but consume all other events, using this code in index.html:
function Trigger(e) {
/* Do not handle Ctrl key combos*/
if (e.which != 17 && !e.ctrlKey) {
var o = {};
o.metaKey = e.metaKey;
o.type = e.type;
if (e.pageXY != undefined) {
o.pageXY = e.pageXY;
}
if (e.pageX != undefined && e.pageY != undefined) {
o.pageXY = [e.pageX,e.pageY];
}
if (e.which != undefined) {
o.which = e.which;
}
$.kc.event(o);
e.preventDefault();
}
}
The text was updated successfully, but these errors were encountered:
My browser, when I start typing into something that is not an entry field (such as the canvas here), it opens a search bar, which then takes focus. This is not desirable when interacting with, say, a game.
I expect there to be similar situations in other environments, where a key press, which is meant to be handled by the application, has other unwanted effects.
The solutions is to call
e.preventDefault()
inTrigger
. But this would disable all keyboard interaction, which is probably not what we want either (e.g.Ctrl-R
is very useful).So I propose to leave every Ctrl-Key-Combo to the browser, but consume all other events, using this code in
index.html
:The text was updated successfully, but these errors were encountered: