Text ignores the system text size: all type is set in px #351

Closed
opened 2026-10-14 19:17:01 +00:00 by kayg · 6 comments
Owner

Where: everywhere (app and mockup, apps/web/src and packages/ui/src).

There are 126 font-size values in px and only 2 in rem (plus 3 in em). Because nothing is in rem, a person who sets a larger text size in their browser or on their phone (iOS Larger Text, Android font scale) gets exactly the same small 12.5 to 14 px interface; only the note text could grow, and not even that if it is in px as well. TASTE.md says "accessible is done", so the largest text size has to work, and I could not test it because it is not there.

Suggested fix: keep the token names (text-ui, text-label, ...) but define them in rem (14 / 16 = 0.875rem, and so on) and set html { font-size: 100% }; fix pill and bar heights with min-height so a bigger label grows the pill; then add a screenshot pass at 200% text on 320, 390 and 1440 (long labels will wrap in the theme segments, the bar and the Insert tiles, which is the interesting part). On iOS the viewport also needs text-size-adjust: 100% so rotating does not rescale.

Found in kayg's overnight UI/UX hunt (#174). App = apps/web at train commit 2ea759c, run locally against the real server with a development user; mockup = https://preview.calternal.cloud.

**Where:** everywhere (app and mockup, `apps/web/src` and `packages/ui/src`). There are **126 `font-size` values in px and only 2 in rem** (plus 3 in em). Because nothing is in rem, a person who sets a larger text size in their browser or on their phone (iOS Larger Text, Android font scale) gets exactly the same small 12.5 to 14 px interface; only the note text could grow, and not even that if it is in px as well. TASTE.md says "accessible is done", so the largest text size has to work, and I could not test it because it is not there. **Suggested fix:** keep the token names (`text-ui`, `text-label`, ...) but define them in rem (14 / 16 = 0.875rem, and so on) and set `html { font-size: 100% }`; fix pill and bar heights with `min-height` so a bigger label grows the pill; then add a screenshot pass at 200% text on 320, 390 and 1440 (long labels will wrap in the theme segments, the bar and the Insert tiles, which is the interesting part). On iOS the viewport also needs `text-size-adjust: 100%` so rotating does not rescale. Found in kayg's overnight UI/UX hunt (#174). App = `apps/web` at train commit 2ea759c, run locally against the real server with a development user; mockup = https://preview.calternal.cloud.
Author
Owner

Screenshots (all taken tonight, Chromium unless it says WebKit):

320 light: the current type; the bar labels and Settings segments are 12.5 to 14 px
trip-320-light.png

Screenshots (all taken tonight, Chromium unless it says WebKit): **320 light: the current type; the bar labels and Settings segments are 12.5 to 14 px** ![trip-320-light.png](https://git.kayg.org/attachments/ed7f0495-a7fd-44ed-94c3-72b480fa8513)
Author
Owner

kayg, 2026-10-15: go. An agent is on it now.

**kayg, 2026-10-15:** go. An agent is on it now.
Author
Owner

How iOS gives web pages its text size, and what this PR does (#351)

Findings:

  • iOS Safari ignores the system text size for px and rem. Settings › Display › Text Size and Accessibility › Larger Text only reach a page that sizes its root with the system font keyword: html { font: -apple-system-body }. Then 1rem is the system body size: 17 px at the usual setting, up to 53 px at the largest. Without it, Safari keeps 1rem at 16 px whatever the setting (WebKit bug 260880, open since 2023; Craig Hockenberry, "Dynamic Type on the Web"; TPGi/Vispero on Dynamic Type; Frontend Masters). It has to be on html, because rem only counts from the root. It is also the route WebKit itself points to for web views (WebKit bug 187013, WONTFIX).
  • Installed apps (PWAs). In Safari the aA menu's page zoom scales everything, px included. A home-screen app has no aA menu, so -apple-system-body is the only way an installed Calternal follows the phone's text size.
  • Side effects of the keyword. On a Mac it makes the root 13 px, so it has to stay off macOS. On iOS, the usual setting gives a 17 px root, not 16, so everything would be 6% bigger unless the sizes allow for it.
  • Android and Chrome. <meta name="text-scale" content="scale"> makes the root follow Android's font scale (MDN, Adrian Roselli). Desktop browsers' own font-size setting already sets the root.

What this PR does:

  1. Every font size counts in --type-px, which is 1/16 of the root (0.0625rem). The type tokens keep their names: --text-ui is calc(14 * var(--type-px)), and so on. The 285 stray px sizes became a token, or calc(N * var(--type-px)) when no token matches. html { font-size: 100% }, text-size-adjust: 100%, and the text-scale meta are set.
  2. On iOS only, @supports (-webkit-touch-callout: none) and (font: -apple-system-body) sets html { font: -apple-system-body } and --type-px: max(1px, calc(1rem / 17)). At the usual setting --type-px is exactly 1 px, so nothing changes. Larger settings grow everything with it. Smaller settings stop at the usual size, so a text field never drops under 16 px, where iOS would zoom the page when the field takes focus. A Mac's Safari doesn't know -webkit-touch-callout, so it keeps 16 px.

I have no real iPhone in this loop: the iOS part follows the sources above and needs one check on a device (Larger Text up, open the installed app).

**How iOS gives web pages its text size, and what this PR does (#351)** Findings: - **iOS Safari ignores the system text size for `px` and `rem`.** Settings › Display › Text Size and Accessibility › Larger Text only reach a page that sizes its root with the system font keyword: `html { font: -apple-system-body }`. Then `1rem` is the system body size: 17 px at the usual setting, up to 53 px at the largest. Without it, Safari keeps `1rem` at 16 px whatever the setting ([WebKit bug 260880](https://bugs.webkit.org/show_bug.cgi?id=260880), open since 2023; [Craig Hockenberry, "Dynamic Type on the Web"](https://furbo.org/2024/07/04/dynamic-type-on-the-web/); [TPGi/Vispero on Dynamic Type](https://vispero.com/resources/text-resizing-web-pages-ios-using-dynamic-type/); [Frontend Masters](https://frontendmasters.com/blog/letting-ios-text-size-setting-affect-font-size-on-the-web/)). It has to be on `html`, because `rem` only counts from the root. It is also the route WebKit itself points to for web views ([WebKit bug 187013](https://bugs.webkit.org/show_bug.cgi?id=187013), WONTFIX). - **Installed apps (PWAs).** In Safari the aA menu's page zoom scales everything, `px` included. A home-screen app has no aA menu, so `-apple-system-body` is the only way an installed Calternal follows the phone's text size. - **Side effects of the keyword.** On a Mac it makes the root 13 px, so it has to stay off macOS. On iOS, the usual setting gives a 17 px root, not 16, so everything would be 6% bigger unless the sizes allow for it. - **Android and Chrome.** `<meta name="text-scale" content="scale">` makes the root follow Android's font scale ([MDN](https://developer.mozilla.org/docs/Web/HTML/Reference/Elements/meta/name/text-scale), [Adrian Roselli](https://adrianroselli.com/2026/02/honoring-mobile-os-text-size.html)). Desktop browsers' own font-size setting already sets the root. What this PR does: 1. Every font size counts in `--type-px`, which is 1/16 of the root (`0.0625rem`). The type tokens keep their names: `--text-ui` is `calc(14 * var(--type-px))`, and so on. The 285 stray `px` sizes became a token, or `calc(N * var(--type-px))` when no token matches. `html { font-size: 100% }`, `text-size-adjust: 100%`, and the `text-scale` meta are set. 2. On iOS only, `@supports (-webkit-touch-callout: none) and (font: -apple-system-body)` sets `html { font: -apple-system-body }` and `--type-px: max(1px, calc(1rem / 17))`. At the usual setting `--type-px` is exactly 1 px, so nothing changes. Larger settings grow everything with it. Smaller settings stop at the usual size, so a text field never drops under 16 px, where iOS would zoom the page when the field takes focus. A Mac's Safari doesn't know `-webkit-touch-callout`, so it keeps 16 px. I have no real iPhone in this loop: the iOS part follows the sources above and needs one check on a device (Larger Text up, open the installed app).
Author
Owner

Screenshots (Chromium, branch issue/351-rem)

At the usual text size, before (dev) vs after, side by side. A pixel diff of all 34 screens (320, 390, 1440; light and dark; note, text bar, block bar, Insert, Settings, Home) is zero everywhere except the list's "last edited" times, which differ because the two runs happened minutes apart.

320 (light note, dark Settings): before | after | before | after
default-320

390 (light Insert, dark text bar): before | after | before | after
default-390

1440 (light Settings, dark Home): before | after
default-1440

At 200% text (root 32 px, as the browser's font-size setting makes it):

320 light: note, Insert, text bar, Settings (top, middle, bottom), list, Home
200-320-light
320 dark: note, Insert, block bar, Settings
200-320-dark
390 light
200-390-light
390 dark
200-390-dark
1440 light: note, Settings
200-1440-light
1440 dark: text bar, Home
200-1440-dark

What broke at 200% and how it's fixed:

  • Note list rows (fixed 57/66 px, virtualised): the titles overlapped the time. The rows now grow with the type, and the virtual list's row height follows it too.
  • Bar: "New" and "Log" overflowed their pills, and the kind showed as "Te…". Pills and rows now use min-height. From about 120% text the phone bar keeps its two lines at every width; the one-row rule from #373 still applies at the usual size.
  • Insert: names were cut off and the grid ran off the sheet. With large text it shows as many tiles a row as fit whole names (2 on phones).
  • Theme segments: they scrolled sideways. Labels now break between words onto two lines, and on narrow phones the words stop growing at about 18 px, as iOS's own segmented controls do.
  • Accent swatches: the names were cut off ("Mari…"). With large text each swatch is a row (dot, then name), one or two columns.
  • Keyboard shortcuts: the keys pushed the whole Settings page sideways. They now go under the name when both don't fit.
  • Titles broke in the middle of a word ("Wednesd/ay"). On phones they now grow up to 13vw.

Still off at 200% (not fixed here):

  • Icons (bar, sidebar, Insert glyphs) and the to-do checkboxes stay at their pixel size, so they look small next to the text.
  • At 1440 the sidebar and list columns keep their widths, so list titles ellipsize sooner.
**Screenshots (Chromium, branch `issue/351-rem`)** **At the usual text size, before (dev) vs after, side by side.** A pixel diff of all 34 screens (320, 390, 1440; light and dark; note, text bar, block bar, Insert, Settings, Home) is zero everywhere except the list's "last edited" times, which differ because the two runs happened minutes apart. 320 (light note, dark Settings): before | after | before | after ![default-320](https://git.kayg.org/attachments/46ab9799-17a7-4ce1-809c-46a5be0bdde3) 390 (light Insert, dark text bar): before | after | before | after ![default-390](https://git.kayg.org/attachments/d2570de7-0efb-4841-a6a7-c9ba2091a604) 1440 (light Settings, dark Home): before | after ![default-1440](https://git.kayg.org/attachments/77d8b857-e30f-46fd-a245-f2a392c2a0b4) **At 200% text** (root 32 px, as the browser's font-size setting makes it): 320 light: note, Insert, text bar, Settings (top, middle, bottom), list, Home ![200-320-light](https://git.kayg.org/attachments/e27d2bd3-f8d8-4de1-88ae-0e3f7fba5776) 320 dark: note, Insert, block bar, Settings ![200-320-dark](https://git.kayg.org/attachments/27dadc0b-ec46-435e-a2ca-61c787d6e5a1) 390 light ![200-390-light](https://git.kayg.org/attachments/d9f28dd9-51ad-4f42-8ecc-7f8f1138e9dd) 390 dark ![200-390-dark](https://git.kayg.org/attachments/22f8ec00-7211-476f-91da-c0071d33f83b) 1440 light: note, Settings ![200-1440-light](https://git.kayg.org/attachments/600ece57-ca98-4583-9817-0540b8c24f9c) 1440 dark: text bar, Home ![200-1440-dark](https://git.kayg.org/attachments/d9e3633d-b983-49d4-ba0b-f9503e000aaa) What broke at 200% and how it's fixed: - **Note list rows** (fixed 57/66 px, virtualised): the titles overlapped the time. The rows now grow with the type, and the virtual list's row height follows it too. - **Bar**: "New" and "Log" overflowed their pills, and the kind showed as "Te…". Pills and rows now use min-height. From about 120% text the phone bar keeps its two lines at every width; the one-row rule from #373 still applies at the usual size. - **Insert**: names were cut off and the grid ran off the sheet. With large text it shows as many tiles a row as fit whole names (2 on phones). - **Theme segments**: they scrolled sideways. Labels now break between words onto two lines, and on narrow phones the words stop growing at about 18 px, as iOS's own segmented controls do. - **Accent swatches**: the names were cut off ("Mari…"). With large text each swatch is a row (dot, then name), one or two columns. - **Keyboard shortcuts**: the keys pushed the whole Settings page sideways. They now go under the name when both don't fit. - **Titles** broke in the middle of a word ("Wednesd/ay"). On phones they now grow up to 13vw. Still off at 200% (not fixed here): - Icons (bar, sidebar, Insert glyphs) and the to-do checkboxes stay at their pixel size, so they look small next to the text. - At 1440 the sidebar and list columns keep their widths, so list titles ellipsize sooner.
Author
Owner

Round 2 at 200% text (Chromium, branch issue/351-rem-2): icons, checkboxes, wider panes, and the screens I hadn't looked at.

At the usual size it is still pixel-identical to dev: I diffed 34 screens again, and the only differences are the "last edited" times and one bar caught mid-animation.

320 light: note, Insert, text bar, block bar, Style, Info, palette, sign-in, Settings ×2, list, Home
r2-320
390 light, same screens
r2-390
1440 light: note, text bar, Style, Info
r2-1440a
1440 light: palette, sign-in, Settings, Home
r2-1440b
Dark: Insert at 320; Style, block bar and Info at 390
r2-dark

What changed:

  • Icons are sized from --icon-px, which follows the text up to 1.5× (24 px for a 16 px icon at 200%). Icon buttons, bar tabs and the Insert glyph boxes grow by the same amount (--icon-grow, 0 at the usual size). They stop at 1.5× so the phone's row of 44 px targets still fits 320 px.
  • To-do checkboxes grow with the icons. So does the list marker box, so wrapped lines and tree lines still line up.
  • Sidebar, list and Settings sections column widen with the text, up to 1.4× and at most 360, 520 and 336 px.
  • Sign-in: the fields and the button ran out of the card. The card now widens (up to 560 px) and keeps them inside.
  • Style: the Opacity and Blur values were cut off, and the font names were squeezed. The value columns now fit their words, and fonts show two to a row.
  • Info: the Properties hint now goes under its label, and in Versions who and when go under the change.
  • The search palette was already fine.
**Round 2 at 200% text (Chromium, branch `issue/351-rem-2`)**: icons, checkboxes, wider panes, and the screens I hadn't looked at. At the usual size it is still pixel-identical to `dev`: I diffed 34 screens again, and the only differences are the "last edited" times and one bar caught mid-animation. 320 light: note, Insert, text bar, block bar, Style, Info, palette, sign-in, Settings ×2, list, Home ![r2-320](https://git.kayg.org/attachments/1c37b525-84af-476a-aeb1-f8249cb4b163) 390 light, same screens ![r2-390](https://git.kayg.org/attachments/573c1d9a-7ccf-40d1-9348-c6d8040b2833) 1440 light: note, text bar, Style, Info ![r2-1440a](https://git.kayg.org/attachments/36321173-fb81-4a10-b816-c4c7bbd08357) 1440 light: palette, sign-in, Settings, Home ![r2-1440b](https://git.kayg.org/attachments/4c158ac7-36f7-4ced-ab76-597a0608fd0f) Dark: Insert at 320; Style, block bar and Info at 390 ![r2-dark](https://git.kayg.org/attachments/ef50290c-62bf-4bba-ba6d-4d1694886f3b) What changed: - **Icons** are sized from `--icon-px`, which follows the text up to 1.5× (24 px for a 16 px icon at 200%). Icon buttons, bar tabs and the Insert glyph boxes grow by the same amount (`--icon-grow`, 0 at the usual size). They stop at 1.5× so the phone's row of 44 px targets still fits 320 px. - **To-do checkboxes** grow with the icons. So does the list marker box, so wrapped lines and tree lines still line up. - **Sidebar, list and Settings sections column** widen with the text, up to 1.4× and at most 360, 520 and 336 px. - **Sign-in**: the fields and the button ran out of the card. The card now widens (up to 560 px) and keeps them inside. - **Style**: the Opacity and Blur values were cut off, and the font names were squeezed. The value columns now fit their words, and fonts show two to a row. - **Info**: the Properties hint now goes under its label, and in Versions who and when go under the change. - **The search palette** was already fine.
Author
Owner

Closing during the 26 Oct handover cleanup: Text follows the system size (rem) in dev (PRs #413, #432, #443).

Closing during the 26 Oct handover cleanup: Text follows the system size (rem) in dev (PRs #413, #432, #443).
kayg closed this issue 2026-10-26 08:46:16 +00:00
Sign in to join this conversation.
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#351
No description provided.