Skip to content

Commit 4e8aee8

Browse files
laugharnclaude
andauthored
fix(template): bump collection price-range input text to 16px on mobile (#373)
iOS Safari auto-zooms the viewport when a focused input's font-size is under 16px. The price-range inputs in FilterPriceRange overrode the base Input's anti-zoom `text-base md:text-sm` with a flat `text-sm` (14px), so tapping a price field zoomed the page. Drop the override so the inputs inherit 16px on mobile / 14px on desktop, and match the `$` prefix span to it. Element box sizes are unchanged. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent a984cd2 commit 4e8aee8

2 files changed

Lines changed: 47 additions & 4 deletions

File tree

apps/template/components/collections/filter-primitives.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,28 +284,28 @@ function FilterPriceRange({
284284
{...props}
285285
>
286286
<div className="flex flex-1 items-center rounded-lg bg-input px-2.5 h-8">
287-
<span className="text-sm text-muted-foreground">{currencySymbol}</span>
287+
<span className="text-base text-muted-foreground md:text-sm">{currencySymbol}</span>
288288
<Input
289289
type="number"
290290
step="0.01"
291291
min="0"
292292
placeholder={fromPlaceholder}
293293
value={minValue}
294294
onChange={(e) => onMinChange?.(e.target.value)}
295-
className="h-auto border-0 bg-transparent px-1 text-sm shadow-none outline-none focus-visible:ring-0 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"
295+
className="h-auto border-0 bg-transparent px-1 shadow-none outline-none focus-visible:ring-0 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"
296296
/>
297297
</div>
298298
<span className="text-muted-foreground"></span>
299299
<div className="flex flex-1 items-center rounded-lg bg-input px-2.5 h-8">
300-
<span className="text-sm text-muted-foreground">{currencySymbol}</span>
300+
<span className="text-base text-muted-foreground md:text-sm">{currencySymbol}</span>
301301
<Input
302302
type="number"
303303
step="0.01"
304304
min="0"
305305
placeholder={toPlaceholder}
306306
value={maxValue}
307307
onChange={(e) => onMaxChange?.(e.target.value)}
308-
className="h-auto border-0 bg-transparent px-1 text-sm shadow-none outline-none focus-visible:ring-0 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"
308+
className="h-auto border-0 bg-transparent px-1 shadow-none outline-none focus-visible:ring-0 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"
309309
/>
310310
</div>
311311
<button
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
title: Collection filters — bump price-range input text to 16px on mobile (prevent iOS focus-zoom)
3+
changeKey: filter-price-input-ios-zoom
4+
introducedOn: 2026-06-22
5+
changeType: fix
6+
defaultAction: adopt
7+
appliesTo:
8+
- all
9+
paths:
10+
- apps/template/components/collections/filter-primitives.tsx
11+
relatedSkills: []
12+
---
13+
14+
## Summary
15+
16+
`FilterPriceRange` (the from/to price inputs in the collection/search filters) rendered its `<input>`s at a flat `text-sm` (14px). The shared `Input` primitive already ships the shadcn anti-zoom pattern — `text-base md:text-sm` (16px on mobile, 14px on desktop) — but the local `text-sm` override flattened it back to 14px at every breakpoint.
17+
18+
- Dropped the `text-sm` class from both price `<input>` overrides so they inherit the base `Input`'s `text-base md:text-sm`.
19+
- Matched the `$` currency-symbol `<span>`s to `text-base text-muted-foreground md:text-sm` so the prefix and the typed value read at one size per breakpoint.
20+
21+
No element box sizes change — the `h-8` pill, `h-auto` input, and `px-1` padding are untouched. Only the font-size per breakpoint changes.
22+
23+
## Why it matters
24+
25+
- iOS Safari auto-zooms the viewport when a focused form control's font-size is **under 16px**. At 14px, tapping a price input zoomed the whole page and left it zoomed. 16px is the hard threshold — 15px still zooms — so 16px is the smallest text that avoids it.
26+
- On desktop (md+) the inputs stay at 14px, so the filter UI looks identical to before; the bump is mobile-only.
27+
28+
## Apply when
29+
30+
- The storefront uses the template's `FilterPriceRange` largely as shipped and serves a Shopify price-range facet on collection/search pages.
31+
32+
## Safe to skip when
33+
34+
- The price inputs were already restyled downstream to `text-base`/16px on mobile (or the price facet is disabled entirely).
35+
36+
## Validation
37+
38+
1. `pnpm --filter template lint`.
39+
2. On a collection with a price facet at a mobile width, the price `<input>` computes to `font-size: 16px` (`md:` ≥768px → 14px). Tapping it on a real iOS device no longer zooms the page.
40+
41+
## See also
42+
43+
- `components/ui/input.tsx` — the base `Input` whose `text-base md:text-sm` pattern these inputs now inherit.

0 commit comments

Comments
 (0)