ref: 1d509dc81961f182629bf0bfd48eed7941122fab
parent: 27c97c0ffdda0b91fecf155f3bc29b32ed806bb2
author: Ben Harris <bjh21@bjh21.me.uk>
date: Mon Nov 14 20:08:08 EST 2022
js: Have the "SoftRight" key open the menu by focussing it
--- a/emccpre.js
+++ b/emccpre.js
@@ -530,6 +530,7 @@
// 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);
@@ -553,6 +554,16 @@
if (dlg_dimmer !== null && event.keyCode == 27) {
command(4);
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ }, 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();
}