vael-ui v0.5.7

Utilities

preventFocusZoom

Stops iOS from zooming in when a form field gets focus, so fields can match the rest of your text size. Call it once on the client, such as in main.ts.

Stops iOS from zooming the page when you focus a field. iOS zooms on any field with text under 16 px, and vael-ui's fields follow your font size, so at 14 px they trigger it. Call preventFocusZoom() once and fields keep your size on iPhone without the zoom. It adds maximum-scale=1 to the viewport on iOS only, where pinch-to-zoom keeps working. Android and desktop never zoom on focus, so it leaves them alone. To get bigger fields on phones instead of changing the viewport, set --ui-touch-font-size: 16px.

Install

import { preventFocusZoom } from 'vael-ui'

Examples

// main.ts
import { preventFocusZoom } from 'vael-ui'

preventFocusZoom()

Parameters

Takes no arguments.

Returns

NameTypeDescription
changedbooleanWhether it changed the viewport: true on iOS, false elsewhere and during server rendering.