Skip to content

Commit a5ad154

Browse files
nesquenaclaude
andcommitted
test: lock the (hover:none)+(pointer:coarse) input zoom threshold (#1167)
Add a regression test that asserts the global mobile media query bumping input/textarea/select to font-size:max(16px,…) is present, so a future per-element font-size tweak (e.g., adding a new 13px input class) cannot silently re-introduce iOS Safari's auto-zoom-on-focus. The existing test_composer_textarea_font_size_mobile only locks the composer textarea — the global rule that closes #1167 across sidebar search, rename inputs, settings selects, and dialog inputs deserves its own assertion. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
1 parent 126224a commit a5ad154

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

tests/test_mobile_layout.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,30 @@ def test_composer_textarea_font_size_mobile():
232232
"Composer textarea must have font-size:16px at mobile widths to prevent iOS zoom-on-focus"
233233

234234

235+
def test_touch_device_inputs_meet_zoom_threshold():
236+
"""All input/textarea/select must clear iOS Safari's 16px zoom threshold
237+
on touch-primary devices, not just the composer textarea (#1167).
238+
239+
This locks the global media-query floor so future per-element font-size
240+
tweaks (sidebar search 13px, settings selects 12px, dialog inputs 14px,
241+
onboarding fields 13px) cannot accidentally re-introduce auto-zoom.
242+
"""
243+
# The hover:none + pointer:coarse pair is the canonical touch-primary
244+
# detection (won't match desktop with mouse, won't match touch laptops
245+
# that report hover:hover).
246+
pattern = re.compile(
247+
r'@media\s*\(hover:none\)\s*and\s*\(pointer:coarse\)\s*\{[^}]*'
248+
r'input\s*,\s*textarea\s*,\s*select\s*\{[^}]*'
249+
r'font-size:\s*max\(\s*16px',
250+
re.DOTALL,
251+
)
252+
assert pattern.search(CSS), (
253+
"style.css must contain a (hover:none) and (pointer:coarse) media "
254+
"query that bumps input/textarea/select to font-size:max(16px,…) "
255+
"so iOS Safari does not auto-zoom on focus (#1167)"
256+
)
257+
258+
235259

236260
# ── Sidebar tabs on mobile ───────────────────────────────────────────────────
237261

0 commit comments

Comments
 (0)