╭ changed ──────────╮ │src/embed/script.js│ ╰───────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────╮ │85 if (html === currentOverlay) return; │ │86 currentOverlay = html; │ │87 overlay.innerHTML = html; │ │88 + }, │ │89 + _focusInput: function (id) { │ │90 + const target = overlay.querySelector(`input[data-focus-id="${id}"]`);│ │91 + if (target && document.activeElement !== target) target.focus(); │ │92 }, │ │93 }, │ │94 }; │ ╰─────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ────────╮ │src/main_wasm.zig│ ╰─────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────╮ │74 const overlay = try web.generateOverlay(allocator, root_ptr, &session); │ │75 defer allocator.free(overlay); │ │76 setOverlay(overlay); │ │77 + │ │78 + // if focused widget is a TextInput, focus on the HTML element │ │79 + const root_focus = root_ptr.getFocus(); │ │80 + if (root_focus.grandchild_id) |gid| { │ │81 + if (root_focus.children.get(gid)) |child| { │ │82 + switch (child.focus.kind) { │ │83 + .text_input, .text_input_password => _focusInput(@intCast(gid)),│ │84 + else => {}, │ │85 + } │ │86 + } │ │87 + } │ │88 } │ │89 │ │90 fn onKeyDown(key_code: u32) !void { │ ╰────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────╮ │125 extern fn _setHtml(arg: [*]const u8, len: u32) void; │ │126 extern fn _setOverlay(arg: [*]const u8, len: u32) void; │ │127 extern fn _pushState(arg: [*]const u8, len: u32) void; │ │128 +extern fn _focusInput(focus_id: u32) void; │ │129 │ │130 /// js calls this first to get a wasm pointer it can write the page json into.│ │131 export fn _alloc(len: u32) ?[*]u8 { │ ╰───────────────────────────────────────────────────────────────────────────────────╯