diff options
Diffstat (limited to 'modules/ext')
| -rw-r--r-- | modules/ext/ui-cockpit.js | 6 | ||||
| -rw-r--r-- | modules/ext/ui-commander.js | 4 |
2 files changed, 10 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 diff --git a/modules/ext/ui-commander.js b/modules/ext/ui-commander.js index 7f980ea..4ffdc8b 100644 --- a/modules/ext/ui-commander.js +++ b/modules/ext/ui-commander.js @@ -172,6 +172,10 @@ body[data-ui-mode="commander"] #ui-root { display: grid; grid-template-columns: if (ev.key === 'Enter' && filtered[sel]) { pick(filtered[sel]); ev.preventDefault(); } }); const onKey = (ev) => { + const t = ev.target; + // Ctrl/Cmd+K belongs to the focused field (kill-line in a terminal input); only intercept + // it from the page body, or typing in the composer opens the palette instead. + if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return; if ((ev.ctrlKey || ev.metaKey) && String(ev.key).toLowerCase() === 'k') { ev.preventDefault(); openPalette(); } |