diff --git a/emccpre.js b/emccpre.js index 8e957a0..2bbaa57 100644 --- a/emccpre.js +++ b/emccpre.js @@ -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