-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Scope the 16px input floor to iOS, not every coarse pointer #6015
Description
Version: @astryxdesign/core 0.5.2
What happens
Text controls carry this rule:
@media (pointer: coarse) { ... { font-size: max(1rem, var(--text-body-size)); } /* inputs, textareas, date/time fields... */ ... { font-size: max(1rem, var(--text-label-size)); } /* Selector / ComplexSelector triggers, panel search */ }
I understand the intent: iOS Safari zooms the page when a focused input is under 16px, and the max(1rem, ...) floor prevents that. The trigger, though, is (pointer: coarse), which is true on a lot more than iPhones:
- Windows laptops with a touchscreen (Chrome flips to
pointer: coarse/hover: nonein tablet mode or after touch input) — controls grow to 16px while the rest of the UI stays at 14px, and fields visibly don't match their labels. - Android phones and tablets, which never zoom on focus.
So the guard costs typography on every touch device to solve a problem that exists on one platform.
Affected components (0.5.2)
Body-size floor: TextInput, NumberInput, TextArea, DateInput (incl. native and touch fields), DateRangeInput, DateTimeInput, TimeInput, FileInput, Typeahead, ChatComposerInput, CommandPaletteInput.
Label-size floor: Selector, ComplexSelector, PanelSearchInput.
Whatever the fix, it'd be good to apply it in one place so all of these move together.
Suggestion
Either of these would keep the iOS protection and leave everyone else alone:
- Scope the floor to iOS.
-webkit-touch-calloutis implemented only by iOS WebKit, so@supports (-webkit-touch-callout: none)nested inside the coarse-pointer query targets exactly the browsers that zoom. - Make it a token. e.g.
--input-min-font-sizedefaulting to1remunder coarse pointers, so a theme can set it to0(or its own floor) without overriding component CSS.