mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 16:05:44 -07:00
js: Move global keyboard handler to capturing phase
In the bubbling phase it managed to catch the "Enter" keypress that opened a dialogue box from the menu and use it to close the dialogue box again. I think it's probably reasonable to have it run earlier and just permanently steal any keypresses it wants.
This commit is contained in:
@ -519,11 +519,16 @@ function initPuzzle() {
|
||||
for (var i in dlg_return_funcs)
|
||||
dlg_return_funcs[i]();
|
||||
command(3);
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
if (dlg_dimmer !== null && event.keyCode == 27)
|
||||
if (dlg_dimmer !== null && event.keyCode == 27) {
|
||||
command(4);
|
||||
});
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
}, true);
|
||||
|
||||
// Event handler to fake :focus-within on browsers too old for
|
||||
// it (like KaiOS 2.5). Browsers without :focus-within are also
|
||||
|
Reference in New Issue
Block a user