fix(web): keep touch text controls at 16px so mobile Safari stops zooming

Every text control in the console was deliberately smaller than 16px — `input`,
`select` and `textarea` inherit `--fs-body` (14px), `.composer__ta` is 15px — and
on iOS focusing one of those makes Mobile Safari zoom the visual viewport in,
which it does not undo when the keyboard closes. The page stays scaled for the
rest of the session.

app.css now puts the floor in one place: a `@media (hover: none), (max-width:
599px)` rule pins `input/select/textarea/[contenteditable]` at 16px. `hover:
none` covers landscape phones that are wider than 600px, and `!important` is
required because a bare element selector loses to the single-class utilities
that style those controls. `html { text-size-adjust: 100% }` stops the same
kind of resizing on rotation. Desktop (a real pointer) is untouched.

The UI shot harness counts the smallest visible text control per page and fails
a shot under 600px if it is under 16px, so the regression cannot come back
silently; docs/ui-parity.md records the check and why the rule lives in app.css.
This commit is contained in:
yuez committed 2026-10-28 08:14:34 +08:00
1 parent 2c44a19d57
commit c08e0c7e94
4 files changed
+127

No files matched your search

+15
View File
@@ -53,6 +53,8 @@
* { margin: 0; }
html, body, #root { height: 100%; }
/* No browser-side text inflation: rotating the phone must not resize the page. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
font-family: var(--font-sans);
font-size: var(--fs-body);
@@ -467,6 +469,19 @@ html[data-pi-blink-slow="dim"] .dot--blink-slow { opacity: .35; }
.field .hint.is-err { color: var(--err); }
.field--invalid .input, .field--invalid .textarea, .field--invalid .select { border-color: var(--err); }
/* ---------- touch: keep every text control at 16px ----------
Focusing a text control smaller than 16px makes Mobile Safari zoom the visual
viewport in, and it does not zoom back out when the keyboard closes — the
page stays scaled for the rest of the session. Every control here is
deliberately smaller (`input/select/textarea` inherit `--fs-body` 14px,
`.composer__ta` is 15px), so the floor lives here once instead of in each
component. `!important` because a bare element selector would lose the
cascade to the one-class utilities that style those controls, and the rule
keys on `hover: none` so landscape phones (well past 600px) are covered too. */
@media (hover: none), (max-width: 599px) {
input, select, textarea, [contenteditable="true"] { font-size: 16px !important; }
}
/* ---------- tabs / progress / kv / misc ---------- */
.tabs { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--border-subtle); }
.tab { padding: var(--space-2) var(--space-3); font-size: .875rem; font-weight: 550; color: var(--muted-foreground); border-bottom: 2px solid transparent; margin-bottom: -1px; }