Skip to content

New rule: form fields under 16px that make iOS Safari zoom on focus #708

Closed

Description

@nc9

Problem

On an iPhone, tapping into a text field whose font size is below 16px makes Safari zoom the page in. The layout jumps sideways, the submit button goes off screen, and the visitor has to pinch back out before they can do anything else. It shows up on almost every checkout, login and newsletter form styled at 14px, which is a very common default: Tailwind's text-sm on an input is 14px, and many component libraries ship 14px fields.

The usual "fix" found online makes things worse: adding maximum-scale=1 to the viewport stops the auto-zoom by also stopping people who need zoom from using it. squirrel already flags that (mobile/viewport-zoom, a11y/zoom-disabled). The real fix is a 16px font size on the fields.

squirrel does not check field font sizes. mobile/font-size reads only inline style attributes, on any element, and only reports sizes under 12px, so a 14px input is never reported.

Proposal

New rule mobile/input-zoom.

  • Warn: a text-entry input, a select or a textarea whose font size is under 16px. One finding per page, listing the fields with their size and where it came from.
  • Fields checked: select, textarea, and input of any text-entry type (text, email, password, search, tel, url, number, date and time types, and an input with no type). Not checked: hidden, checkbox, radio, range, color, file, and the button types, which do not open a keyboard.
  • Says how the size was found. A static audit can read inline style attributes and <style> blocks only. When a field's size comes from an external stylesheet or a utility class the rule cannot resolve, it is not judged, and the result says how many fields went unread.
  • Rendered pages: when the audit renders pages at a phone width, the rule reads each field's computed font size instead, which covers external stylesheets, utility classes and inherited sizes.
  • With a zoom-blocking viewport: a page with maximum-scale=1 hides the symptom on iOS, but the viewport rules ask for that to be removed, which brings the zoom back. The fields are still reported, and the finding says the 16px fix is what lets both findings be fixed together.

The rule's solution text recommends font-size: 16px (or 1rem on a 16px root) on form fields at phone widths, for example Tailwind's text-base md:text-sm, and never recommends disabling zoom.

Notes

  • Cost: low. The static check walks the page's form fields and its <style> blocks, which page rules already have. The rendered check needs computed styles from a rendered crawl, which the engine does not expose to rules yet; that half can follow once rendered page data reaches rules (see New rule: security/csp-violations - report what the browser actually blocked during rendered crawls #425).
  • False-positive risk: the static check only reports a size it reads plainly from a selector that matches the field, so its risk is missed fields, not wrong ones. It does not guess from class names.
  • Related: mobile/font-size (body text), mobile/viewport-zoom and a11y/zoom-disabled (the viewport workaround).

Acceptance Criteria

  • Fixture: <input type="email" style="font-size:14px"> produces a warning naming the field and its 14px size
  • Fixture: a <style> block with input, select { font-size: 0.875rem } and a 16px root produces a warning for each matching field
  • Fixture: the same fields at font-size: 16px or 1rem produce no finding
  • type="checkbox", radio, range, color, file, hidden, submit and button inputs at 12px produce no finding
  • Fixture: fields styled only by an external stylesheet produce no warning in a static audit, and the result reports them as not read
  • Fixture: a page with <meta name="viewport" content="width=device-width, maximum-scale=1"> and 14px fields still gets the warning, and the finding mentions the viewport workaround
  • The rule's solution text recommends a 16px field size and does not suggest disabling zoom
  • The rule has a docs page under docs/rules/mobile/

Activity

  1. added
    enhancement
    size: S
    rules
    on Oct 12, 2026
  2. added 19 commits that reference this issue on Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementrulessize: S

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions