Skip to content

Your lightweight open-source personal agent.

fix(webui): enlarge preview controls on touch devices

Xubin Ren13cec0146d98
diff --git a/docs/webui.md b/docs/webui.md
index 392538836..65718519c 100644
--- a/docs/webui.md
+++ b/docs/webui.md
@@ -198,6 +198,11 @@ magnified area; normal fitting resumes when
you return to the default zoom. Non-touch desktop and native-host layout remain
unchanged.
+On touch devices, preview tab controls and
+the full-screen image viewer's close button use larger touch areas without
+enlarging the icons. Preview tabs remain horizontally scrollable when space is
+limited.
+
Open the context indicator beside the composer model badge to see how much of
the model's context window is in use. The **Recent rounds** chart shows input
tokens for each logical model round, including tool-call rounds. Hover or focus
diff --git a/webui/src/components/ImageLightbox.tsx b/webui/src/components/ImageLightbox.tsx
index 7e497501a..c6078ff94 100644
--- a/webui/src/components/ImageLightbox.tsx
+++ b/webui/src/components/ImageLightbox.tsx
@@ -142,7 +142,7 @@ export function ImageLightbox({
<DialogPrimitive.Close
aria-label={t("lightbox.close")}
className={cn(
- "absolute right-4 top-4 grid h-9 w-9 place-items-center rounded-full",
+ "touch-target absolute right-4 top-4 grid h-9 w-9 place-items-center rounded-full",
"bg-black/55 text-white/90 hover:bg-black/70 hover:text-white",
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/70",
"transition-colors motion-reduce:transition-none",
diff --git a/webui/src/components/PreviewPane.tsx b/webui/src/components/PreviewPane.tsx
index bc9602ad4..efd1c40a7 100644
--- a/webui/src/components/PreviewPane.tsx
+++ b/webui/src/components/PreviewPane.tsx
@@ -51,7 +51,7 @@ export function PreviewPane({ tabs, activeId, width, isClosing, onSelect, onClos
? remaining[Math.min(index, remaining.length - 1)]?.id ?? null : activeId;
onCloseTab(tab.id);
};
- const iconButton = "inline-flex size-8 shrink-0 items-center justify-center rounded-control text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring";
+ const iconButton = "touch-target inline-flex size-8 shrink-0 items-center justify-center rounded-control text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring";
return <aside aria-label={t("previewTabs.title")} data-testid="preview-pane" data-file-preview-panel
style={{
"--file-preview-width": `${width}px`,
@@ -65,7 +65,7 @@ export function PreviewPane({ tabs, activeId, width, isClosing, onSelect, onClos
className="file-preview-resize group absolute inset-y-0 left-0 z-20 hidden w-2 cursor-col-resize touch-none justify-start focus-visible:outline-none">
<span aria-hidden className="h-full w-px bg-foreground/25 opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100" />
</button>
- <div className="flex h-10 shrink-0 items-center gap-1 border-b border-border/40 px-2">
+ <div className="flex min-h-10 shrink-0 items-center gap-1 border-b border-border/40 px-2">
<div ref={tabList} role="tablist" aria-label={t("previewTabs.title")} className="min-w-0 flex-1 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden">
<SidebarSelectionHighlight activeId={activeId} scope="preview-tabs" targetSelector="[data-preview-tab-active]"
className="relative isolate flex w-max min-w-full items-center gap-1"
@@ -74,7 +74,7 @@ export function PreviewPane({ tabs, activeId, width, isClosing, onSelect, onClos
const selected = tab.id === activeId;
const name = tabName(tab);
const item = <div key={tab.id} role="presentation" data-preview-tab-active={selected ? "" : undefined}
- className={cn(SIDEBAR_SELECTION_ITEM_CLASS, "group flex h-8 max-w-56 shrink-0 items-center rounded-compact", selected ? "text-foreground" : "text-muted-foreground hover:bg-muted/50 hover:text-foreground")}>
+ className={cn(SIDEBAR_SELECTION_ITEM_CLASS, "group flex min-h-8 max-w-56 shrink-0 items-center rounded-compact", selected ? "text-foreground" : "text-muted-foreground hover:bg-muted/50 hover:text-foreground")}>
<button type="button" role="tab" id={`${id}-tab-${index}`} aria-selected={selected} aria-controls={`${id}-panel`}
tabIndex={selected ? 0 : -1} title={tab.value}
ref={(node) => { if (node) buttons.current.set(tab.id, node); else buttons.current.delete(tab.id); }}
@@ -91,7 +91,7 @@ export function PreviewPane({ tabs, activeId, width, isClosing, onSelect, onClos
onSelect(tabs[next].id);
buttons.current.get(tabs[next].id)?.focus();
}}
- className="flex h-8 min-w-0 items-center gap-1.5 rounded-compact pl-2.5 pr-1.5 text-[12.5px] font-medium leading-5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring">
+ className="touch-target flex h-8 min-w-0 items-center gap-1.5 rounded-compact pl-2.5 pr-1.5 text-[12.5px] font-medium leading-5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring">
<span aria-hidden className="flex size-3.5 shrink-0 items-center justify-center text-muted-foreground">
{tab.kind === "web" ? <Globe2 className="size-3.5" />
: <FileReferenceIcon kind={fileKindForPath(tab.value)} className="size-3.5" />}
@@ -100,7 +100,7 @@ export function PreviewPane({ tabs, activeId, width, isClosing, onSelect, onClos
</button>
<button type="button" tabIndex={selected ? 0 : -1} aria-label={t("previewTabs.closeTab", { name })} title={t("previewTabs.closeTab", { name })}
onClick={() => closeTab(tab, index)}
- className={cn("mr-1 inline-flex size-6 shrink-0 items-center justify-center rounded-compact text-muted-foreground transition-colors hover:bg-foreground/10 hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", !selected && "sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100")}>
+ className={cn("touch-target preview-tab-close mr-1 inline-flex size-6 shrink-0 items-center justify-center rounded-compact text-muted-foreground transition-colors hover:bg-foreground/10 hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", !selected && "sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100")}>
<X className="size-3" aria-hidden />
</button>
</div>;
diff --git a/webui/src/globals.css b/webui/src/globals.css
index d3055cd89..5d689dc43 100644
--- a/webui/src/globals.css
+++ b/webui/src/globals.css
@@ -878,6 +878,10 @@
min-width: 2.75rem;
min-height: 2.75rem;
}
+
+ .touch-target.preview-tab-close {
+ opacity: 1;
+ }
}
/* On phones, actions follow the message instead of taking a separate gutter. */