╭ changed ──╮ │src/web.zig│ ╰───────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭────────────────────────────────────────────────────────────────────────────────╮ │407 if (entry.ti.options.name.len > 0) { │ │408 try out.appendSlice(allocator, "\" name=\""); │ │409 try appendEscapedHtml(allocator, &out, entry.ti.options.name); │ │410 + } │ │411 + // mark the wasm-focused element so JS can mirror it onto DOM focus│ │412 + // — otherwise moving focus via arrow keys leaves the TUI border │ │413 + // showing focus but the underlying <input> unfocused. │ │414 + if (entry.focus_id == root_focus.grandchild_id) { │ │415 + try out.appendSlice(allocator, "\" data-focused=\"true"); │ │416 } │ │417 try out.appendSlice(allocator, "\" value=\""); │ │418 var value_buf: std.ArrayList(u8) = .empty; │ ╰────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │438 if (current_id != null) try out.appendSlice(allocator, "</span>"); │ │439 if (cell_id) |id| { │ │440 const kind = if (root_focus.children.get(id)) |entry| entry.focus.kind else .container; │ │441 + const focused_attr: []const u8 = if (id == root_focus.grandchild_id) " data-focused=\"true\"" else "";│ │442 var buf: [256]u8 = undefined; │ │443 // tabindex="0" on submit buttons puts them in the browser's │ │444 // natural Tab order alongside the inputs above. │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │445 const tag = if (kind == .submit_button) │ │439 - try std.fmt.bufPrint(&buf, "<span class=\"clickable\" data-focus-id=\"{d}\" data-action=\"submit\" data-url=\"{s}\" tabindex=\"0\">", .{ id, submit_url }) │ │446 + try std.fmt.bufPrint(&buf, "<span class=\"clickable\" data-focus-id=\"{d}\" data-action=\"submit\" data-url=\"{s}\" tabindex=\"0\"{s}>", .{ id, submit_url, focused_attr })│ │447 else │ │441 - try std.fmt.bufPrint(&buf, "<span class=\"clickable\" data-focus-id=\"{d}\">", .{id}); │ │448 + try std.fmt.bufPrint(&buf, "<span class=\"clickable\" data-focus-id=\"{d}\"{s}>", .{ id, focused_attr }); │ │449 try out.appendSlice(allocator, tag); │ │450 } │ │451 current_id = cell_id; │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯