Skip to content

Your lightweight open-source personal agent.

fix(webui): keep touch form fields readable without focus zoom

Xubin Ren948ce3824653
diff --git a/docs/webui.md b/docs/webui.md
index ee7a2672e..704c33665 100644
--- a/docs/webui.md
+++ b/docs/webui.md
@@ -207,6 +207,10 @@ magnified area; normal fitting resumes when
you return to the default zoom. Non-touch desktop and native-host layout remain
unchanged.
+On touch devices, compact text fields use a readable 16px minimum baseline to
+avoid Safari automatically zooming the page on focus. Desktop field density
+and manual page zoom 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
diff --git a/webui/src/components/remote/HostSwitcher.tsx b/webui/src/components/remote/HostSwitcher.tsx
index ea5baba7d..60887c155 100644
--- a/webui/src/components/remote/HostSwitcher.tsx
+++ b/webui/src/components/remote/HostSwitcher.tsx
@@ -91,7 +91,7 @@ function HostMenuItems({ picker }: { picker: HostPicker }) {
<Search aria-hidden className="h-4 w-4 shrink-0 text-muted-foreground" />
<input ref={search} aria-label={t("remote.searchHosts")} placeholder={t("remote.searchHosts")}
value={query} onChange={(event) => setQuery(event.target.value)} autoComplete="off" spellCheck={false}
- className="h-7 min-w-0 flex-1 bg-transparent text-[13px] outline-none placeholder:text-muted-foreground" />
+ className="touch-text-input h-7 min-w-0 flex-1 bg-transparent text-[13px] outline-none placeholder:text-muted-foreground" />
</div> : <DropdownMenuLabel className="shrink-0">{t("remote.switchHost")}</DropdownMenuLabel>}
<div ref={list} role="group" aria-label={t("remote.switchHost")}
className="min-h-0 overflow-y-auto overscroll-contain scrollbar-thin scrollbar-track-transparent">
diff --git a/webui/src/components/thread/PromptNavigator.tsx b/webui/src/components/thread/PromptNavigator.tsx
index d0a02cfff..b42e3e288 100644
--- a/webui/src/components/thread/PromptNavigator.tsx
+++ b/webui/src/components/thread/PromptNavigator.tsx
@@ -83,7 +83,7 @@ export function PromptNavigator({
aria-label={t("thread.promptNavigator.search")}
placeholder={t("thread.promptNavigator.search")}
className={cn(
- "h-10 w-full rounded-full border border-border bg-background pl-9 pr-3 text-sm",
+ "touch-text-input h-10 w-full rounded-full border border-border bg-background pl-9 pr-3 text-sm",
"transition-colors",
formControlFocusClassName,
)}
diff --git a/webui/src/components/ui/input.tsx b/webui/src/components/ui/input.tsx
index fc889032f..db9a0683c 100644
--- a/webui/src/components/ui/input.tsx
+++ b/webui/src/components/ui/input.tsx
@@ -11,7 +11,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
<input
type={type}
className={cn(
- "flex h-10 w-full rounded-full border border-input bg-background px-3 py-2 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
+ "touch-text-input flex h-10 w-full rounded-full border border-input bg-background px-3 py-2 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
formControlFocusClassName,
className,
)}
diff --git a/webui/src/components/ui/textarea.tsx b/webui/src/components/ui/textarea.tsx
index 74cddc263..555794e80 100644
--- a/webui/src/components/ui/textarea.tsx
+++ b/webui/src/components/ui/textarea.tsx
@@ -10,7 +10,7 @@ const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
return (
<textarea
className={cn(
- "flex min-h-[60px] w-full rounded-control border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
+ "touch-text-input flex min-h-[60px] w-full rounded-control border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
formControlFocusClassName,
className,
)}
diff --git a/webui/src/globals.css b/webui/src/globals.css
index 94ad53d3b..4062fff11 100644
--- a/webui/src/globals.css
+++ b/webui/src/globals.css
@@ -885,6 +885,14 @@
}
@media (pointer: coarse) {
+ /* Readable form text avoids Safari's focus zoom without disabling the user's
+ pinch zoom. Keep this after utilities so compact desktop overrides cannot
+ shrink shared form fields on touch devices. Larger chat/search text stays
+ on its own typography; this is not a blanket rule for every input. */
+ .touch-text-input {
+ font-size: max(16px, 1rem);
+ }
+
.thread-message-row,
.message-block-menu-trigger,
[data-message-block-menu] {
diff --git a/webui/src/tests/touch-input.test.tsx b/webui/src/tests/touch-input.test.tsx
new file mode 100644
index 000000000..0a411f945
--- /dev/null
+++ b/webui/src/tests/touch-input.test.tsx
@@ -0,0 +1,47 @@
+import { readFileSync } from "node:fs";
+import { resolve } from "node:path";
+import { render, screen } from "@testing-library/react";
+import postcss from "postcss";
+import tailwindcss from "tailwindcss";
+import loadConfig from "tailwindcss/loadConfig";
+import { describe, expect, it } from "vitest";
+
+import { Input } from "@/components/ui/input";
+import { Textarea } from "@/components/ui/textarea";
+
+describe("touch form typography", () => {
+ it("keeps the touch baseline on compact shared fields without changing desktop classes", () => {
+ render(<>
+ <Input aria-label="Name" />
+ <Input aria-label="Address" className="text-[13px]" />
+ <Textarea aria-label="Pairing code" className="font-mono text-xs" />
+ </>);
+ for (const field of screen.getAllByRole("textbox")) {
+ expect(field).toHaveClass("touch-text-input");
+ }
+ expect(screen.getByLabelText("Name")).toHaveClass("text-sm");
+ expect(screen.getByLabelText("Address")).toHaveClass("text-[13px]");
+ expect(screen.getByLabelText("Pairing code")).toHaveClass("text-xs", "font-mono");
+ });
+
+ it("emits the baseline after compact utilities, only for opted-in touch fields", async () => {
+ const config = loadConfig(resolve(process.cwd(), "tailwind.config.js"));
+ const source = readFileSync(resolve(process.cwd(), "src/globals.css"), "utf8");
+ const result = await postcss([tailwindcss({ ...config, content: [{
+ raw: 'class="touch-text-input text-xs text-sm text-[13px] text-[19px]"',
+ }] })]).process(source, { from: undefined });
+ let baseline = -1;
+ let index = 0;
+ const compact: number[] = [];
+ result.root.walkRules((rule) => {
+ index++;
+ if ([".text-xs", ".text-sm", ".text-\\[13px\\]"].includes(rule.selector)) compact.push(index);
+ if (rule.selector !== ".touch-text-input") return;
+ baseline = index;
+ expect(rule.parent).toMatchObject({ type: "atrule", name: "media", params: "(pointer: coarse)" });
+ expect(rule.nodes).toContainEqual(expect.objectContaining({ prop: "font-size", value: "max(16px, 1rem)" }));
+ });
+ expect(compact).toHaveLength(3);
+ expect(baseline).toBeGreaterThan(Math.max(...compact));
+ });
+});