Repository navigation
fix(theme): text follows the reader's text size in Safari on iPhone, in every theme - #10416
Conversation
Supersedes #8230, rebased onto main. On iPhone and iPad the root Theme measures the reader's text size from one hidden, empty probe with font: -apple-system-body and gives the page that category's scales in an adopted stylesheet. Every theme writes its font sizes as its own values times the scale of the UIKit text style each plays, so only sizes move, and every scale is 1 at the default size and in every other browser. Changes from #8230's last head: root Themes in one document share the one probe and stylesheet, and the last one out removes them; the probe's mark moves to a private-attribute owner module; the header comments no longer cite records. Co-authored-by: Christopher Chedeau <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| Toast | 97.0 kB (+7 B) · 10.2 kB CSS (0) | — | — · — · — |
| lab/DialogHeroHeader | 81.8 kB (+2 B) · 372 B CSS (0) | — | — · — · — |
| lab/ListInput | 100.5 kB (+2 B) · 1.6 kB CSS (0) | — | — · — · — |
5 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| Markdown | 179.5 kB (+1 B) · 20.3 kB CSS (0) | — | — · — · — |
| Overlay | 22.3 kB (0) · 3.9 kB CSS (0) | — | — · — · — |
| charts/Chart | 197.9 kB (−1 B) · 494 B CSS (0) | — | — · — · — |
| lab/Comments | 339.5 kB (−7 B) · 2.5 kB CSS (0) | — | — · — · — |
| lab/CommentThread | 332.7 kB (−10 B) · 2.4 kB CSS (0) | — | — · — · — |
Package size:
- @astryxdesign/cli 3.52 MB packed (+604 B); no new dependencies
- @astryxdesign/core 7.03 MB packed (+15.7 kB); no new dependencies
- @astryxdesign/theme-butter 46.1 kB packed (+303 B); no new dependencies
6 more packages
- @astryxdesign/theme-chocolate 13.8 kB packed (+217 B); no new dependencies
- @astryxdesign/theme-gothic 32.8 kB packed (+207 B); no new dependencies
- @astryxdesign/theme-matcha 28.2 kB packed (+208 B); no new dependencies
- @astryxdesign/theme-neutral 36.6 kB packed (+239 B); no new dependencies
- @astryxdesign/theme-stone 38.0 kB packed (+302 B); no new dependencies
- @astryxdesign/theme-y2k 35.1 kB packed (+208 B); no new dependencies
API changes: none in this pull request
Committed API report behind this build: cli 29 rows, core 35 rows, theme-butter 1 row, theme-y2k 1 row; run pnpm api:report.
Wide change (shared styles: packages/core/src/theme/Theme.tsx, packages/core/src/theme/dynamicType.ts, packages/core/src/theme/generateThemeRules.ts, and 1 more): add ci:run-visual or ci:run-rtl to run them.
Generated by PR Enrichment workflow | View full report
…be per document The spec owners' carve-out, verbatim, plus a verification row: one probe per document, none from a nested Theme, removed with the last root Theme, absent where font: -apple-system-body is unsupported.
|
AI review status for this pull request.
|
|
/approve-spec 0d5da03 |
There was a problem hiding this comment.
Changes requested. The approach matches spec:AST-102 FR3, and the INV7 carve-out has an engineering owner's approval for this head. Three things need fixing before approval:
packages/core/src/theme/dynamicType.ts:408-414creates its ownResizeObserverfor the probe; use Core's sharedobserveResize(utils/sharedResizeObserver.ts) instead, so text-size sync stays on the one resize-observation path (architecture:react-component-runtimeINV16).- The changeset says this works "On iPhone and iPad" and in "all" iPhone and iPad browsers, but the only device evidence is Safari on an iPhone simulator, so either add iPad Safari to the new run or narrow the wording.
- The only Safari-on-iOS run comes from the earlier pull request, recorded before the private
--_scaled-*caps and the shared probe, so please re-record Safari on iOS at this head (xs, default and an accessibility size, a branded theme, a live Settings change) and show that macOS Safari is unchanged, asspec:AST-102's browser evidence asks.
On this head, an emulated run in Chromium and WebKit matches the earlier simulator numbers and leaves the default size pixel-identical to main. Three small comment suggestions are inline.
[Automated review]
…he changeset claims only what is evidenced The probe's resize now goes through observeResize, which also takes the first reading. The changeset names Safari on iPhone, where the evidence was recorded, instead of every iPhone and iPad browser.
|
/approve-spec 71f6cd3 |
… and its open evidence gap
|
/approve-spec 36e968a |
There was a problem hiding this comment.
Changes requested. The shared observeResize and the narrowed changeset fix two of the three earlier findings, and the record edits have an engineering owner's approval for this head. Two things remain:
- Miss:
packages/cli/assets/docs/tree/type-scale.doc.mjs:155, the Dynamic Type story's description and the pull request title still say this works on iPhone and iPad and in every iOS browser, while the evidence and this pull request's ownspec:AST-102line cover only Safari on iPhone, so narrow them to Safari on iPhone as the changeset now does. spec:AST-102names Safari on iOS as the proof for FR3 and the only Safari run is of an earlier revision, so please record Safari on iPhone at this head (xs, default and an accessibility size, a branded theme, a live Settings change) and show that macOS Safari is unchanged.
An emulated run in Chromium on this head matches the earlier simulator numbers and leaves the default size pixel-identical to main. Two small non-blocking suggestions are inline.
[Automated review]
|
/approve-spec 85f12c8 |
There was a problem hiding this comment.
Changes requested. The Dynamic Type scaling still matches spec:AST-102 FR3 on this head; two items remain before approval.
- Regression: the type-scale doc section (
packages/cli/assets/docs/tree/type-scale.doc.mjs:159) saysButtonkeeps a fixed height so its label can overflow, but a labelled Button grows with its label undercomponent:ButtonFR4, so please dropButtonfrom that sentence. - Please record one macOS Safari reading at the default text size on this code (the probe's computed
font-size, and the Dynamic Type story's body and supporting sizes against the theme's own), which thespec:AST-102FR3 verification row requires because the probe and the scale sheet also mount in macOS Safari.
The non-blocking notes on the long file headers and comments and the 12px wording are still open inline. CI is still running on this head; the jobs that have finished pass.
[Automated review]
The Dynamic Type section listed Button among the fixed-height controls, but under component:Button FR4 a labelled Button grows with its label.
|
/approve-spec 80433a1 |
There was a problem hiding this comment.
Changes requested: the Dynamic Type scaling matches spec:AST-102 FR3 and the record edits carry an engineering owner's approval for this head, but one item remains before approval.
- Please record one macOS Safari reading at the default text size on this code (the probe's computed
font-size, and the Dynamic Type story's body and supporting sizes against the theme's own), which thespec:AST-102FR3 verification row requires because the probe and the scale sheet also mount in macOS Safari anddynamicType.ts:25states its 13px Body as fact.
The description now calls that reading a follow-up, but the FR3 verification row still lists macOS Safari at this head and the M1 visual pass it cites names no browser and measures no size; if the owners defer the reading, that belongs in the record with an owner's approval for the head. The non-blocking notes on the long file headers and comments, the 12px wording and the doc's "labels" wording are open inline. CI has not run on this head: its jobs were skipped while the pull request is a draft.
[Automated review]
…3's row The FR3 verification row lists macOS Safari at its default text size as covered by dynamicType.test.ts (its fixed 13 px Body names no category, so every scale stays 1), with a browser reading as a recorded follow-up. The changeset and story name 0.75rem, which main now writes, and four comments are shorter.
|
/approve-spec 79d7baf |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet, because its jobs were skipped while the pull request is a draft.
The Dynamic Type scaling matches spec:AST-102 FR3, and the record edits carry an engineering owner's approval for this head, including the FR3 verification row that records the macOS Safari reading as a follow-up; that row settles the reading the last review asked for.
Non-blocking: the two long file headers in dynamicType.ts and uikitTypography.ts are still open inline, and an issue for the macOS Safari follow-up would keep it from being lost.
[Automated review]
| | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | FR1 | Source check over Core and Lab component styles plus token review | family, size, and line height of rendered text in component styles; an inherited value; a `1em` icon size; coarse and fine pointer; a platform font keyword; the iOS text-entry floor | A Core or Lab web component sets the family, size, or line height of text it renders outside typography tokens and not by inheritance, or applies a platform font keyword directly; icon sizing, the family floor, and a hidden internal element that only measures a platform text style are not failures | | ||
| | FR2 | Theme token review plus Safari on iOS, top-level document | an unbranded shipped theme using the system body font family; a branded theme; the default theme | A branded theme's body font replaced by the system font, or a system body font applied by a component instead of a theme token | | ||
| | FR3 | Safari on iOS across Dynamic Type categories; Chrome on Android in the emulator with font scale; a desktop browser with a larger default font size and with zoom; theme review; `scripts/check-theme-text-size-units.test.mjs` (no first-party theme sets a text or font size in px) | a branded and an unbranded theme; no size set; default category; a size set on each platform; macOS Safari at its default text size, whose fixed 13 px Body names no category, so every scale stays 1 (`dynamicType.test.ts`; a browser reading is a recorded follow-up) | Text that ignores a size the person set; text that differs from the theme's family or size when none is set, other than the `family:input-fields` FR9 iOS text-entry floor; a theme family replaced; a public option, prop, or document attribute; a changed root font size | |
There was a problem hiding this comment.
Non-blocking: no issue tracks this follow-up; the defect line at :114-116 is its only record. An issue for the macOS Safari reading at the default text size (the probe's computed font-size, and the Dynamic Type story's body and supporting sizes against the theme's own) keeps it from being lost.
The Current-state defects line still listed macOS Safari at its default text size as unverified. FR3's verification row records a browser reading there as a recorded follow-up, so the line now names it a recorded follow-up verification. Safari on iPad and other iOS browsers stay unverified.
|
/approve-spec 0719c5b |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet, because every job is skipped while the pull request is a draft; marking it ready for review runs CI.
The Dynamic Type scaling matches spec:AST-102 FR3, and the record edits carry an engineering owner's approval for this head. The AST-102 defect line now names the macOS Safari reading a recorded follow-up, matching the FR3 verification row.
Non-blocking:
- Miss: the paragraph added to the
Theme.tsxfile header (lines 21-24) repeatsuseRootTextSizeSync's JSDoc in one 41-word sentence; dropping it keeps the header withinarchitecture:knowledge-contractsINV29. - The long file headers in
dynamicType.tsanduikitTypography.tsare still open inline. - An issue for the macOS Safari reading would keep that follow-up from being lost.
[Automated review]
| * The root Theme also reads the reader's text size (iOS Dynamic Type) from a | ||
| * hidden, empty `font: -apple-system-body` probe and keeps the page's scales | ||
| * in an adopted stylesheet; every theme's font sizes follow them, and no | ||
| * attribute is written (see dynamicType.ts). |
There was a problem hiding this comment.
Non-blocking. Miss: earlier reviews did not flag this unchanged paragraph. The file header already runs past architecture:knowledge-contracts INV29's limit of about 12 lines, and this 41-word sentence repeats what useRootTextSizeSync's JSDoc (lines 326-331) says. Drop the paragraph:
* outside the Theme wrapper (portals, toast fallback viewports).
*
* For RSC / SSR, set `data-theme` on `<html>` in your root server layout
Summary
People using Safari on iPhone who choose a text size in Settings (Display & Text Size, then Larger Text) get Astryx text at that size, in every theme. Native apps already follow that setting, but Astryx pages don't: a reader who needs 53 px body text still gets 16 px. At the default size, and in every other browser, nothing changes.
Supersedes #8230 (by vjeux), rebased onto current main with Co-authored-by. #8230 was closed only in a stale-PR triage, and nobody else is working on it.
What changes
theme/dynamicType.tsandtheme/uikitTypography.ts(from fix(core): text follows the reader's text size on iOS in every theme #8230): the UIKit point-size table per text style, the category a measured Body size names, and each raw font-size step's curve and scale.generateThemeRules.ts: every theme writes each raw font-size step as its own value times the scale of the UIKit text style that step plays. A semantic size a theme fixes at a length, such as Butter, Stone and Y2K's 12 px supporting text, scales on its default step's curve. Every scale is 1 unless the root sets it.Theme.tsx: the rootThemekeeps the scales current throughsyncReaderTextSize. Nested Themes don't.observeResize), not a ResizeObserver of its own;privateAttributes/textSizeProbe.stylex.ts);[fix]changeset for core and cli.The probe element (INV7)
The spec owners ruled the probe allowed, as a consistency point. This PR adds their carve-out to
architecture:component-style-authoringINV7, word for word: "The theme runtime may own one shared, empty, aria-hidden probe element per document, outside every component's DOM, used only to read a platform text size; it renders no content, is not a theming target, and is removed with the last root Theme."It also adds a verification row: one probe per document; none from a nested Theme; removed with the last root Theme; absent where
font: -apple-system-bodyis unsupported. Each is backed bydynamicType.test.tsandTheme.test.tsx.The probe itself:
<span aria-hidden="true">, empty and 1em square, withvisibility: hidden,position: fixedandpointer-events: none. It carriesfont: -apple-system-bodyand renders no text.Themes. It mounts on<body>, outside any component's DOM.font: -apple-system-body.Evidence
At l, no text-size scale applies. The phone values are larger than desktop Chromium's 14 / 12 because each theme has its own touch type sizes.
-apple-system-bodyprobe and the Dynamic Type story's body and supporting sizes is a recorded follow-up. Expected: a fixed 13 px Body that names no category, so every scale stays 1. ThedynamicType.test.tscase "scales nothing where the keyword follows no reader setting (a fixed 13px Body, as on a Mac)" covers that path.dynamicType.test.tsandTheme.test.tsxcover this.import {Theme}grew by about 1.6 kB gzip of JavaScript, with no CSS.Tests
dynamicType.test.ts: the category table and curves, the gate, the scales, follow-on-resize, cleanup, and a new case where two root Themes share one probe and the last one out removes it.tsc -p packages/core. Strict eslint is clean.Writing rubric results
spec:AST-102Current-state impact: the Dynamic Type line states the shipped, recorded state, what stays unverified (Safari on iPad and other iOS browsers) and the recorded follow-up verification (macOS Safari at its default text size), in the present tense and with no references to pull requests.R1 narration: none; the INV7 sentence is in the present tense and was supplied verbatim by the spec owners.
R2 research in the record: none; the simulator numbers stay in this description.
R3 evidence naming a change: none.
R4 rejected alternatives: none added.
R5 pull request or issue references remaining: none.