Repository navigation
feat(rules): mobile/input-zoom reports form fields under 16px that make iOS Safari zoom (#708) - #897
Conversation
|
Review of The design is conservative: it reports a field as not read when it can't tell, instead of guessing. Match budgets cap the work on hostile stylesheets. The docs, changelog and golden-test updates are consistent with each other.
Test coverage: No critical or high-severity issues found. |
|
Review triage at 38f4927:
Gates at this sha: input-zoom + hidden-text tests 173 pass; rules typecheck clean; |
|
Reviewed the diff for Findings
What looks good
I found no correctness or security problems. |
|
Round 2 triage at 3e462fa:
|
|
Review of
|
|
Round 3 triage at 8bd44d1:
|
Review of #897 (
|
|
Round 4 triage at 4d67860 (final round from my side unless something blocking comes up):
Gates at this sha: input-zoom + verdict-scope + template-verdict tests 448 pass; rules typecheck clean; |
|
Review of The design is conservative: anything it can't resolve becomes "not read" instead of a guess, and every scan has a budget. I found no merge-blocking problems.
Security and performance: I saw no ReDoS risk. The Test coverage looks broad ( |
4d67860 to
9a7bab1
Compare
|
Reviewed
Test coverage is good: 29 cases, including hostile-input and cap tests. I could not run the suite here, so I am relying on the PR's reported results. |
|
Triage of the review at 9a7bab1 (no further push planned for these; none is blocking):
|
…ke iOS Safari zoom (#708) New page rule. Reads field sizes from inline styles and <style> blocks in cascade order; an unstyled field on a page with no external CSS gets iOS's own 11px. A size unseen rules may outrank, or that comes from a media query, a relative unit, an unrunnable selector or a hiding rule, is counted as not read, never guessed. A zoom-blocking viewport still gets the warning and the message names the workaround. Docs page, nav, counts, CHANGELOG; canonical golden tally 308 -> 309. Signed-off-by: Nik Cubrilovic <[email protected]>
…p formatter churn (#708) Past 200 fields, unfocusable ones are skipped as below the cap (scan capped at 2,000). Restores hidden-text.ts and the canonical golden test to main plus the intended export and tally edits. Tests for the cap and <style media=screen|all>. Signed-off-by: Nik Cubrilovic <[email protected]>
…unt comment, cheaper focus walk (#708) Signed-off-by: Nik Cubrilovic <[email protected]>
…te (#708) It reads each page's own fields and style blocks, so pages of one template can differ. Listed as varying in the template-invariance measurement for both corpora, as security/token-storage was, since the measured crawls predate the rule. Signed-off-by: Nik Cubrilovic <[email protected]>
… next to an external sheet (#708) Signed-off-by: Nik Cubrilovic <[email protected]>
#708) None of them styles the live screen. Tests for that and for the 2,000-field scan cap; WebKit source linked next to the 11px default. Signed-off-by: Nik Cubrilovic <[email protected]>
Field depth 128, selector length 256, inline style 4,096 chars, 256 style blocks, a font shorthand 1,000 chars, and a shared budget of 10,000 selector tests or 250 ms. Selectors are prepared once per page; a hiding rule is tested once per element, not per field and ancestor. Item text is cut to 80 chars. Number patterns no longer backtrack quadratically. Hostile-page tests: 50k inputs, a 5 MB sheet, 20k nested @media, 3,000-deep fields, deep descendant and :has() selectors, a 300 KB selector, 1 MB styles and attributes, 20k style blocks, a 100k-digit size. Signed-off-by: Nik Cubrilovic <[email protected]>
9a7bab1 to
775491b
Compare
|
Review of I read the rule implementation in Findings
Overall Nothing blocking in the part I read. The design is conservative: anything it cannot read statically becomes
|
|
Reviewed
|
Closes #708
What
New rule
mobile/input-zoom: on an iPhone, focusing a text field, select or textarea under 16px makes Safari zoom the page in. The rule reports those fields, one finding per page, each with its size and where the size came from.select,textarea, and everyinputthat opens a keyboard or picker. Skipped: hidden/checkbox/radio/range/color/file and the button types, plus fields a visitor cannot focus (disabled, disabled fieldset,hidden/inertancestors, inlinedisplay:none, closed<dialog>/<details>,<template>/<noscript>) and, as a precaution,aria-hiddenspam traps (Mailchimp's embed).styleand<style>blocks, applied in cascade order (!importantinline,!importantrules, inline, plain rules; per-declaration!important; last declaration wins).remresolves against the root size from the same cascade on<html>.font: 11px system-uioninput,textareaandselect, and the focus zoom scale is16 / fontSize(WKWebViewIOS.mm). So a field nothing on the page sizes zooms too, and on a page with no external stylesheet it is reported as11px (iOS default).<style>size or the default, when the deciding rule is inside@media/@supports/@layeror a<style media>block, when matching rules disagree, when the size is relative (em,%,var(),calc(),font: inherit,all), when afontshorthand is outside the narrow grammar the rule parses, when a selector uses a state the engine cannot run (:focus,:hover,:scope, also inside:not()), when a<style>rule hides the field, or past the reading budgets (see the bounded-work section below). Inline sizes are still judged with an external stylesheet present.maximum-scale=1,user-scalable=no) still gets the warning, and the message names the workaround.text-base md:text-sm) and never disabling zoom.content/hidden-text.ts: only exportsparseRulesandRawRulefor reuse. Reviewing it turned up a pre-existing comment-handling miss in itsparseDeclarations, filed as #896 (not changed here).Bounded work on hostile pages (untrusted-input self-audit)
Every loop over page-controlled input has a hard cap, and no path skips it. The rule never fetches or reads an external stylesheet, and never expands
@import; it only notes that one exists.<style>text@media/@supports/@layernestingparseRulesdepth counter), no recursionstylefontshorthand:has()additionalpast that; attribute values and selectors in an item cut to 80 charsRegexes on page strings were checked for backtracking: the number patterns (
\d*\.?\d+) were quadratic on a long digit run and are now\d+(?:\.\d+)?|\.\d+; the rest are linear or run only on capped strings.Measured before the caps, the security flag was right: a 1 MB wrapper style or 3,000 hiding rules over a deep wrapper ran past 45 s, a 300 KB selector took 4.5 s, and 500 KB field styles took 5 s. After the caps, the rule's own time (page parse excluded) is 1 to 260 ms on every case.
input-zoom-708.test.tshas a hostile-page suite asserting under 1,000 ms and bounded output: 50,000 inputs, a 5 MB stylesheet, 20,000 nested@media, fields 3,000 deep, 3,000 hiding rules, 1,400 rules with 250-char selectors, 3,000 descendant selectors on 120-deep fields, 3,000:has()selectors over a 20,000-element form, a 100,000-digit size, a 300 KB selector, a 1 MB wrapper style, 500 KB field styles, 20,000 style blocks, a 100,000-token shorthand, and a 1 MBnameattribute.Checks
bun testinput-zoom, hidden-text, rule-verdict-scope, template-verdict-*, docs-category-table, meta-string-limits, noindex-skip, max-rules-limit, private-target-skip: 974 pass, 0 failpackages/rulestypecheck (tsgo): cleanbun run test:engine: 209 pass / 1 skip / 0 failhidden-text.tsuntouched)check-links+tangly check --strict: pass11px (iOS default); GitHub, Wikipedia, gov.uk, DuckDuckGo, lobste.rs and BBC report their fields as not read; no false warnings. Same results after the caps, 1 to 9 ms per page.Docs and skills
Docs: new
docs/rules/mobile/input-zoom.mdx, nav entry, Mobile index card, Mobile rule count 7 -> 8 indocs/rules/index.mdxanddocs/rules/seo/index.mdx,viewport-zoomrelated link, the rule-count comment inpackages/utils/src/constants.ts. CHANGELOG Unreleased entry. The rule isverdictScope: "page"and listed undervaryingRulesintemplate-invariance-measured.json.Agent skill (
squirrelscan/skills): no change needed; the skills name no individual rules and their "260+ rules" count stays true.Private follow-up in the next gitlink bump: regenerate the rule catalog (
apps/api: bun run generate:rule-catalog) and bumptotalRulesinapps/web/src/components/rules.tsxto 309.