╭ changed ────────╮ │src/main_wasm.zig│ ╰─────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────╮ │54 session.applyPending(); │ │55 │ │56 try root_ptr.build(allocator, .{ │ │57 - // min_height lets the TUI fill the viewport when its content is │ │58 - // short; max height stays null so taller content extends downward │ │59 - // and the browser scrolls. │ │57 + // bind the UI to the browser viewport (cols x rows) like the terminal: │ │58 + // min == max height fills it exactly, and each Scroll clips to its │ │59 + // viewport while handing its full content to a native-scrollable element.│ │60 .min_size = .{ .width = null, .height = min_height }, │ │61 - .max_size = .{ .width = max_width, .height = null }, │ │61 + .max_size = .{ .width = max_width, .height = min_height }, │ │62 }, root_ptr.getFocus()); │ │63 │ │64 // mirror the page Header settled on into the browser URL. these are │ ╰──────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ 99 else => {}, │ │100 } │ │101 │ │102 - // keep the focused widget within the browser viewport. only fire on │ │103 - // an actual focus change so we don't fight the user's manual │ │104 - // scrolling on unrelated ticks. │ │102 + // keep the focused widget visible within its own scrollable element. │ │103 + // only fire on an actual focus change so we don't fight the user's │ │104 + // manual scrolling on unrelated ticks. │ │105 if (gid != last_scrolled_focus_id) { │ │106 last_scrolled_focus_id = gid; │ │107 - const r = child.rect; │ │108 - _scrollToRect(@intCast(r.x), @intCast(r.y), @intCast(r.size.width), @intCast(r.size.height));│ │107 + _scrollToFocus(@intCast(gid)); │ │108 } │ │109 } │ │110 } │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────╮ │177 extern fn _replaceState(arg: [*]const u8, len: u32) void; │ │178 extern fn _focusInput(focus_id: u32) void; │ │179 extern fn _navigate(arg: [*]const u8, len: u32) void; │ │181 -extern fn _scrollToRect(x: u32, y: u32, width: u32, height: u32) void; │ │180 +extern fn _scrollToFocus(focus_id: u32) void; │ │181 │ │182 /// js calls this first to get a wasm pointer it can write the page json into.│ │183 export fn _alloc(len: u32) ?[*]u8 { │ ╰───────────────────────────────────────────────────────────────────────────────────╯