all repos — honk @ d4f7fc985e96104824190a499715772482508d47

my fork of honk

handle escape hotkey earlier, even in input
Ted Unangst tedu@tedunangst.com
Mon, 19 Feb 2024 23:02:02 -0500
commit

d4f7fc985e96104824190a499715772482508d47

parent

efc9f4df39c2272cd9bc160cffc7c7ef342e00f9

1 files changed, 7 insertions(+), 6 deletions(-)

jump to
M views/honkpage.jsviews/honkpage.js

@@ -456,9 +456,14 @@ }

} function hotkey(e) { - if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) + if (e.ctrlKey || e.altKey) + return + if (e.code == "Escape") { + var menu = document.getElementById("topmenu") + menu.open = false return - if (e.ctrlKey || e.altKey) + } + if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) return switch (e.code) {

@@ -482,10 +487,6 @@ menu.querySelector("a").focus()

} else { menu.open = false } - break - case "Escape": - var menu = document.getElementById("topmenu") - menu.open = false break case "Slash": document.getElementById("topmenu").open = true