Type follows the reader's text size (#351) #413

Closed
kayg wants to merge 0 commits from issue/351-rem into dev
Owner

Closes #351.

Type now follows the reader's text size: the browser's font size, Android's font scale, and iOS Text Size / Larger Text. At the usual size it looks exactly as before. The research, screenshots and before/after pixel diff are on #351.

How

  • Every font size counts in --type-px (tokens.css), which is 0.0625rem: 1 px at the usual size, 2 px at 200%. The type tokens keep their names, and the ~285 stray px sizes in apps/web/src, packages/ui/src and apps/mockup became a token or calc(N * var(--type-px)).
  • html { font-size: 100% }, text-size-adjust: 100%, and <meta name="text-scale" content="scale"> (Android font scale in Chrome).
  • iOS only (@supports (-webkit-touch-callout: none) and (font: -apple-system-body)): html { font: -apple-system-body } and --type-px: max(1px, 1rem / 17). Exactly 1 px at the usual setting, so nothing changes there. It grows with Larger Text, including in the installed app, which has no Safari aA menu. It never shrinks, so text fields stay at 16 px or more and iOS doesn't zoom when one takes focus. Macs are left alone.
  • Pills, bar rows, the Insert search and Settings rows use min-height. The note list's rows and date headers grow in type-px, and the virtual list's row height follows them through textSize.px.
  • packages/ui/src/lib/text-size.svelte.ts: one hidden probe with a ResizeObserver, so it only fires when the text size changes, never per frame. It sets data-text="large" from about 120%. With large text the phone bar keeps two lines at every width, swatches become rows, Insert shows fewer tiles a row, theme segments break between words, and keyboard keys go under their names. The usual size keeps #373's rules: one row at 375 px and up, two lines at 320/360.
  • Titles grow up to 13vw on phones, so "Wednesday," no longer breaks in the middle of the word.

Tests

  • New e2e/text-size.spec.ts: the usual size is unchanged, and at 200% on 320/390/1440 nothing is cut off and nothing scrolls sideways (Insert, text bar, Settings).
  • chromium-390: phone-, bar-, editor, tabs, glass, toast-bar, text-size all pass. The 4 failures in the first run were trace-file clashes between two runs in one folder; they pass on rerun.
  • chromium-1440: same specs pass. prefs-chromium and prefs-webkit pass.
  • webkit-390: phone-edges, phone-targets (159), bar-rest, bar-stays, bar-stable, bar-taps, editor, tabs, glass, toast-bar and text-size pass. phone-bars: 233 of 240 passed and none failed; the 25-minute run limit stopped it twice before the last 7. bar-focus "typing" (390, 430) times out at 30 s, and it does the same on a clean dev checkout on this machine.
  • ui primitives: 32 unit tests and 96 e2e pass. Typecheck: 0 errors.
  • Mockup: the build passes and break.spec passes, including its 200% case. story.spec has failures that clean dev has too (checked on a clean checkout).

🤖 Generated with Claude Code

https://claude.ai/code/session_018Yyy8fQGxPLkLa8v8NXz7T

Closes #351. Type now follows the reader's text size: the browser's font size, Android's font scale, and iOS Text Size / Larger Text. At the usual size it looks exactly as before. The research, screenshots and before/after pixel diff are on #351. **How** - Every font size counts in `--type-px` (tokens.css), which is `0.0625rem`: 1 px at the usual size, 2 px at 200%. The type tokens keep their names, and the ~285 stray px sizes in `apps/web/src`, `packages/ui/src` and `apps/mockup` became a token or `calc(N * var(--type-px))`. - `html { font-size: 100% }`, `text-size-adjust: 100%`, and `<meta name="text-scale" content="scale">` (Android font scale in Chrome). - iOS only (`@supports (-webkit-touch-callout: none) and (font: -apple-system-body)`): `html { font: -apple-system-body }` and `--type-px: max(1px, 1rem / 17)`. Exactly 1 px at the usual setting, so nothing changes there. It grows with Larger Text, including in the installed app, which has no Safari aA menu. It never shrinks, so text fields stay at 16 px or more and iOS doesn't zoom when one takes focus. Macs are left alone. - Pills, bar rows, the Insert search and Settings rows use min-height. The note list's rows and date headers grow in type-px, and the virtual list's row height follows them through `textSize.px`. - `packages/ui/src/lib/text-size.svelte.ts`: one hidden probe with a ResizeObserver, so it only fires when the text size changes, never per frame. It sets `data-text="large"` from about 120%. With large text the phone bar keeps two lines at every width, swatches become rows, Insert shows fewer tiles a row, theme segments break between words, and keyboard keys go under their names. The usual size keeps #373's rules: one row at 375 px and up, two lines at 320/360. - Titles grow up to 13vw on phones, so "Wednesday," no longer breaks in the middle of the word. **Tests** - New `e2e/text-size.spec.ts`: the usual size is unchanged, and at 200% on 320/390/1440 nothing is cut off and nothing scrolls sideways (Insert, text bar, Settings). - chromium-390: phone-*, bar-*, editor, tabs, glass, toast-bar, text-size all pass. The 4 failures in the first run were trace-file clashes between two runs in one folder; they pass on rerun. - chromium-1440: same specs pass. prefs-chromium and prefs-webkit pass. - webkit-390: phone-edges, phone-targets (159), bar-rest, bar-stays, bar-stable, bar-taps, editor, tabs, glass, toast-bar and text-size pass. phone-bars: 233 of 240 passed and none failed; the 25-minute run limit stopped it twice before the last 7. bar-focus "typing" (390, 430) times out at 30 s, and it does the same on a clean `dev` checkout on this machine. - ui primitives: 32 unit tests and 96 e2e pass. Typecheck: 0 errors. - Mockup: the build passes and `break.spec` passes, including its 200% case. `story.spec` has failures that clean `dev` has too (checked on a clean checkout). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_018Yyy8fQGxPLkLa8v8NXz7T
Type follows the reader's text size (#351)
Some checks failed
CI / server (pull_request) Successful in 30s
CI / rust (pull_request) Successful in 2m5s
CI / web (pull_request) Failing after 43m56s
84224f6e90
Every font size is counted in --type-px (1/16 of the root size) instead of px: the type tokens and
the ~285 stray sizes in apps/web, packages/ui and apps/mockup. The root is the browser's own size
(html { font-size: 100% }), Android's font scale (meta text-scale), and on iPhone/iPad the system
text size via `font: -apple-system-body`, scaled so the usual setting is pixel-identical.

Pills, bars, list rows and fields grow with their words (min-height, or heights in type-px). From
about 120% (data-text="large", lib/text-size: one ResizeObserver on a probe, never per frame) the
phone bar keeps two lines, swatches become rows, Insert takes fewer tiles a row, theme segments
wrap, keyboard keys go under their names. Titles stop growing at 13vw so long words fit.

New e2e/text-size.spec.ts checks the usual size is unchanged and that nothing is cut off or
sideways at 200% on 320/390/1440.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Yyy8fQGxPLkLa8v8NXz7T
Author
Owner

Replaced by #432, which has this PR's commit plus the review fixes: icons and checkboxes grow with the text, wider panes at large text, and Info, Style and sign-in at 200%. Closing.

Replaced by #432, which has this PR's commit plus the review fixes: icons and checkboxes grow with the text, wider panes at large text, and Info, Style and sign-in at 200%. Closing.
kayg closed this pull request 2026-10-15 10:54:52 +00:00
Some checks failed
CI / server (pull_request) Successful in 30s
CI / rust (pull_request) Successful in 2m5s
CI / web (pull_request) Failing after 43m56s

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal!413
No description provided.