╭ changed ──────────╮ │src/embed/script.js│ ╰───────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭───────────────────────────────────────────────────────────────────────────────────╮ │159 overlay.innerHTML = html; │ │160 }, │ │161 _focusInput: function (id) { │ │162 - const target = overlay.querySelector(`[data-focus-id="${id}"]`); │ │163 - if (target && document.activeElement !== target) target.focus(); │ │162 + const target = overlay.querySelector(`[data-focus-id="${id}"]`) ||│ │163 + grid.querySelector(`input[data-focus-id="${id}"]`); │ │164 + if (!target) return; │ │165 + if (document.activeElement !== target) target.focus(); │ │166 + if (target.readOnly) target.select(); │ │167 }, │ │168 _navigate: function (ptr, len) { │ │169 // a real browser navigation to another top-level page (the wasm │ ╰───────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────╮ │217 const ptr = wasmInstance.exports._alloc(bytes.length); │ │218 new Uint8Array(wasmInstance.exports.memory.buffer, ptr, bytes.length).set(bytes);│ │219 wasmInstance.exports._setTextInputValue(focusId, ptr, bytes.length); │ │217 - wasmInstance.exports._tick(minRows(), maxCols()); │ │218 -} │ │219 - │ │220 -function sendEnter(form) { │ │221 - const btn = form.querySelector("button[type=submit][data-focus-id]"); │ │222 - if (!btn) return; │ │223 - wasmInstance.exports._onMouseClick(Number(btn.dataset.focusId)); │ │224 - wasmInstance.exports._onKeyDown(13); │ │220 wasmInstance.exports._tick(minRows(), maxCols()); │ │221 } │ │222 │ ╰──────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │335 const t = event.target; │ │336 if (!t || (t.tagName !== "INPUT" && t.tagName !== "TEXTAREA") || !t.dataset.focusId) return;│ │337 sendTextInputValue(Number(t.dataset.focusId), t.value); │ │343 - }); │ │344 - │ │345 - document.addEventListener("click", (event) => { │ │346 - const t = event.target; │ │347 - if (t && t.tagName === "INPUT" && t.readOnly) t.select(); │ │338 }); │ │339 │ │340 document.addEventListener("focusin", (event) => { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────╮ │354 }); │ │355 │ │356 grid.addEventListener("click", (event) => { │ │357 + if (event.target.matches("input[readonly]")) { │ │358 + wasmInstance.exports._tick(minRows(), maxCols()); │ │359 + return; │ │360 + } │ │361 const span = event.target.closest(".clickable"); │ │362 if (!span) return; │ │363 // leave modified / non-left clicks (open-in-new-tab, etc.) to the browser│ ╰───────────────────────────────────────────────────────────────────────────────────────╯