// Which key events the screen page leaves to the browser instead of sending to // the remote desktop. Kept apart from `screen.html` so a test can load it; // `build.mjs` bundles it as `static/screen-keys.js`, which the page loads ahead // of its own script as `hiveScreenKeys`. /** * Keys that belong to the browser or to the page's own buttons: reload (F5, * Ctrl/Cmd+R), the address bar (Ctrl/Cmd+L), the dev tools (F12), and any key * pressed while a button has focus (so Enter and Space can click it). * * @param {{ key: string, ctrlKey?: boolean, metaKey?: boolean, target?: any }} ev */ export function keepForBrowser(ev) { if (ev.target?.closest?.("button")) return true; if (ev.key === "F5" || ev.key === "F12") return true; return Boolean(ev.ctrlKey || ev.metaKey) && /^[rl]$/i.test(ev.key); }