From: Ian Jackson Date: Sat, 3 Apr 2021 23:19:07 +0000 (+0100) Subject: js: Avoid duplicate handling of keystrokes X-Git-Tag: otter-0.5.0~225 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=0395bd667c8041a6cebfa1b0c4c8d34245a1d0ab;p=otter.git js: Avoid duplicate handling of keystrokes We didn't notice that keys you type into input boxes (currently, just zoom) get fed to the play interpreter too, because you would only type digits there which are ignored. But we are about to pay attention to digits. Signed-off-by: Ian Jackson --- diff --git a/templates/script.ts b/templates/script.ts index 761e5ee6..a1aa33bf 100644 --- a/templates/script.ts +++ b/templates/script.ts @@ -387,6 +387,11 @@ function some_keydown(e: KeyboardEvent) { // my tsc says this isComposing thing doesn't exist. wat. if ((e as any).isComposing /* || e.keyCode === 229 */) return; if (e.ctrlKey || e.altKey || e.metaKey) return; + if (e.target) { + // someone else is dealing with it ? + let tag = (e.target as HTMLElement).tagName; + if (tag == 'INPUT') return; + } let pane = pane_keys[e.key]; if (pane) {