diff options
| author | Ben Harris <bjh21@bjh21.me.uk> | 2022-11-15 01:08:08 +0000 |
|---|---|---|
| committer | Ben Harris <bjh21@bjh21.me.uk> | 2023-01-19 20:34:48 +0000 |
| commit | 1d509dc81961f182629bf0bfd48eed7941122fab (patch) | |
| tree | 82fc5707d400ea0c5b970f2c018baf89d791d158 | |
| parent | 27c97c0ffdda0b91fecf155f3bc29b32ed806bb2 (diff) | |
| download | puzzles-1d509dc81961f182629bf0bfd48eed7941122fab.zip puzzles-1d509dc81961f182629bf0bfd48eed7941122fab.tar.gz puzzles-1d509dc81961f182629bf0bfd48eed7941122fab.tar.bz2 puzzles-1d509dc81961f182629bf0bfd48eed7941122fab.tar.xz | |
js: Have the "SoftRight" key open the menu by focussing it
| -rw-r--r-- | emccpre.js | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -530,6 +530,7 @@ function initPuzzle() { // Prevent default even if we didn't do anything, as long as this // was an interesting key. event.preventDefault(); + event.stopPropagation(); } menuform.addEventListener("keydown", menukey); @@ -558,6 +559,16 @@ function initPuzzle() { } }, true); + document.addEventListener("keydown", function(event) { + // Key to open the menu on KaiOS. + if (event.key == "SoftRight" && + !menuform.contains(document.activeElement)) { + menuform.querySelector("li div").focus(); + 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 // too old for focusin/out events, so we have to use focus events |