diff options
| author | Ben Harris <bjh21@bjh21.me.uk> | 2023-01-01 23:29:25 +0000 |
|---|---|---|
| committer | Ben Harris <bjh21@bjh21.me.uk> | 2023-01-19 20:34:48 +0000 |
| commit | b8e9bfa7f6a1d96e8cae96f43d7b5a1394abb447 (patch) | |
| tree | 666294bbc1e2ecd793e9b3320aa3a40190bfe081 | |
| parent | b6f783e26e9d692dc2243bf5cf945cc0717c00aa (diff) | |
| download | puzzles-b8e9bfa7f6a1d96e8cae96f43d7b5a1394abb447.zip puzzles-b8e9bfa7f6a1d96e8cae96f43d7b5a1394abb447.tar.gz puzzles-b8e9bfa7f6a1d96e8cae96f43d7b5a1394abb447.tar.bz2 puzzles-b8e9bfa7f6a1d96e8cae96f43d7b5a1394abb447.tar.xz | |
kaios: Make F10 open and close the menu
This is no use on KaiOS itself, but provides a way to open the menu from
the keyboard on desktop browsers for testing (and for
keyboard-accessibility in general).
| -rw-r--r-- | emccpre.js | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -491,7 +491,7 @@ function initPuzzle() { if (dlg_dimmer !== null) return; if (!["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Enter", - "Escape", "Backspace", "SoftRight"] + "Escape", "Backspace", "SoftRight", "F10"] .includes(event.key)) return; if (ishorizontal(thismenu)) { @@ -535,7 +535,7 @@ function initPuzzle() { else if (event.key == "Enter") event.target.click(); else if (event.key == "Escape" || event.key == "SoftRight" || - event.key == "Backspace") + event.key == "F10" || event.key == "Backspace") // Leave the menu entirely. onscreen_canvas.focus(); // Prevent default even if we didn't do anything, as long as this @@ -599,7 +599,7 @@ function initPuzzle() { document.addEventListener("keydown", function(event) { // Key to open the menu on KaiOS. - if (event.key == "SoftRight" && + if ((event.key == "SoftRight" || event.key == "F10") && !menuform.contains(document.activeElement)) { menuform.querySelector("li div").focus(); event.preventDefault(); |