diff options
Diffstat (limited to 'modules/ext/ui-cockpit.js')
| -rw-r--r-- | modules/ext/ui-cockpit.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/ext/ui-cockpit.js b/modules/ext/ui-cockpit.js index ffb6c2a..92dd60b 100644 --- a/modules/ext/ui-cockpit.js +++ b/modules/ext/ui-cockpit.js @@ -106,6 +106,12 @@ body[data-ui-mode="cockpit"] #ui-root { display: grid; grid-template-rows: 1fr 1 const onKey = (ev) => { const m = /^F([1-8])$/.exec(String(ev.key)); if (!m) return; + const t = ev.target; + // Never swallow keys aimed at a text field, and leave F1/F12 to the browser: the handler + // used to preventDefault on all eight, so help, the address bar and devtools were dead + // while the cockpit was open (found by review). + if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return; + if (ev.key === 'F1' || ev.key === 'F12') return; ev.preventDefault(); const idx = parseInt(m[1], 10); if (idx === 5) { refresh(); return; } // F5 = refresh, as labelled |