diff --git a/.changes/user-interface/work-resolve-issue-issue-14210-42565250791-1-1b8a9379.md b/.changes/user-interface/work-resolve-issue-issue-14210-42565250791-1-1b8a9379.md new file mode 100644 index 00000000000..bfffbc41811 --- /dev/null +++ b/.changes/user-interface/work-resolve-issue-issue-14210-42565250791-1-1b8a9379.md @@ -0,0 +1,7 @@ +--- +bump: minor +--- + +### Added + +- `typography.long_form_body_px` (default `18`, at least `16`): the size of long-form reading text, which the web typography rules write in `rem` above the `16px` body floor. The default is the low end of Emil Kowalski's 18 to 20px for long-form text ([post](https://x.com/emilkowalski/status/2112245483464802700)); the config check refuses a value under `16`. diff --git a/docs/upstream/emilkowalski-skills.md b/docs/upstream/emilkowalski-skills.md index a13f595b01b..902411a1c34 100644 --- a/docs/upstream/emilkowalski-skills.md +++ b/docs/upstream/emilkowalski-skills.md @@ -78,6 +78,18 @@ Each upstream link is at the pin. | [`skills/prototype/SKILL.md`](https://github.com/emilkowalski/skills/blob/5206a950b715e0cabe7043ea0b2304332b91494e/skills/prototype/SKILL.md) | [`/prototype:explore-directions`](../../plugins/prototype/skills/explore-directions/SKILL.md) and `prototype` `context/discipline.md` | Absorbed (skill omitted) | **Taken:** variants differ on a named axis, the tradeoff table, never pre-pick a winner, cut a converged variant. | | [`skills/prototype/PICKER.md`](https://github.com/emilkowalski/skills/blob/5206a950b715e0cabe7043ea0b2304332b91494e/skills/prototype/PICKER.md) | `prototype` `skills/explore-directions/assets/variant-switcher.html` | Derived | **Taken:** the floating switcher's controls and behavior. **Rejected:** URL persistence, which a `file://` page cannot rely on. | +## Post sources + +Defaults and rules taken from his posts rather than the repository. A post has no pin, so the drift +check does not watch these rows. + +- **As of**: 2026-11-09 +- **Recheck trigger**: he posts a different long-form reading size, or the linked post is removed. + +| Key or topic | Post | Taken / rejected | +|---|---|---| +| `typography.long_form_body_px` | [2026-10-19](https://x.com/emilkowalski/status/2112245483464802700) | **Taken:** long-form reading text at 18 to 20px rather than 16px, his stated preference with no measurement, for long-form text only. The default is `18`, the low end of his range, by the owner's decision that the reading research does not contradict it; a team overrides it through the key. The skill writes it in `rem`. **Floor:** the `16px` body floor ([USWDS typography](https://designsystem.digital.gov/components/typography/)) holds over his value as the schema's `minimum`; it did not change his value. | + ## Map Units we took nothing from; each counts only if removed upstream. diff --git a/plugins/user-interface/README.md b/plugins/user-interface/README.md index ca9728a57e5..216714884b9 100644 --- a/plugins/user-interface/README.md +++ b/plugins/user-interface/README.md @@ -92,12 +92,16 @@ order. Keys and allowed values are in [`reference/team.schema.json`](reference/t | `animation.gesture.velocity_threshold` | `0.11` | px/ms for a small element's swipe to dismiss | | `animation.gesture.distance_threshold` | `0.4` | Fraction of its own travel, 0 to 1, past which a dragged element dismisses on release | | `components.primitives_default` | `base-ui` | `base-ui`, `radix`, `react-aria`: the primitives library a React project with none installed builds on | +| `typography.long_form_body_px` | `18` | px, at least `16`: long-form reading text, written in `rem` | | `routing` | none | route rows, `disable` and `deny`, team layer only | The `css` keys are read by `/user-interface:write-css`; its [`configuration.md`](skills/write-css/reference/configuration.md) says what each one changes. The `animation` keys are taste defaults that apply only where the project has no motion tokens of its own; `/user-interface:write-animation` reads them all, and write-css reads the curves and durations. +The `typography` key is read through the `typography` concern by `/user-interface:design` and +`/user-interface:audit`, and applies only where the project has no type tokens for long-form text; +the config check refuses a value under the `16px` body floor. `routing` is validated and shown by `/user-interface:setup check`, and `/user-interface:design` routes from the bundled rows with it applied: a row with a bundled concern and id overrides that row key by key, a new row adds a route, and `disable` and `deny` skip routes (a `deny` skip names diff --git a/plugins/user-interface/reference/defaults.yaml b/plugins/user-interface/reference/defaults.yaml index f0f965e9b30..c0d5088d76d 100644 --- a/plugins/user-interface/reference/defaults.yaml +++ b/plugins/user-interface/reference/defaults.yaml @@ -125,3 +125,7 @@ animation: # page gives). The project's installed library and design system beat every layer. components: primitives_default: base-ui +# Long-form reading text (articles, documentation) in px, never below the 16px body floor; a skill +# writes it in rem, the value divided by the root size in px. Project tokens beat every layer. +typography: + long_form_body_px: 18 diff --git a/plugins/user-interface/reference/team.schema.json b/plugins/user-interface/reference/team.schema.json index 46135d6ec51..eb9e1ffc812 100644 --- a/plugins/user-interface/reference/team.schema.json +++ b/plugins/user-interface/reference/team.schema.json @@ -151,6 +151,14 @@ "primitives_default": {"enum": ["base-ui", "radix", "react-aria"], "description": "The accessible primitives library a React project with none installed builds on, by its setting value in the primitives table in reference/component-libraries.md; a setting value is not a package name."} } }, + "typography": { + "type": "object", + "additionalProperties": false, + "description": "Typography taste defaults read by the typography concern in reference/types/web/typography.md. The project's own type tokens beat every layer.", + "properties": { + "long_form_body_px": {"type": "integer", "minimum": 16, "description": "The size in px of long-form reading text (articles, documentation), never below the 16px body floor; a skill writes it in rem, the value divided by the root size in px."} + } + }, "routing": { "type": "object", "additionalProperties": false, diff --git a/plugins/user-interface/reference/types/web/typography.md b/plugins/user-interface/reference/types/web/typography.md index 95cb234ee17..c610393f20a 100644 --- a/plugins/user-interface/reference/types/web/typography.md +++ b/plugins/user-interface/reference/types/web/typography.md @@ -230,6 +230,16 @@ concern. **Audit: Important.** Body text under `16px`, text under `12px`, or a layout that breaks when the text is zoomed or the root font size is raised. +**Set long-form reading larger.** Articles, documentation and other text read for minutes at a time +sit at `typography.long_form_body_px` (default `18`, `1.125rem` over a `16px` root), a size above +the body floor, not a change to body text: dense interface text keeps the sizes above. The key is +in px; write the size in `rem`, the key's value divided by the root size in px, so it still grows +when the reader raises the root font size. The project's own type tokens beat the key. + +**Audit: Suggestion.** Long-form reading text below the configured long-form size, or set in `px`, +where the project has no type token for it. A `px` size here is one finding under this rule, not a +second one under "Units for text" in `typography/scale-and-rhythm.md`. + ## Reviewing typography 1. Detect the styling system first and phrase every fix in it. diff --git a/plugins/user-interface/tests/defaults.test.mjs b/plugins/user-interface/tests/defaults.test.mjs index 741ec372020..ffdba97f287 100644 --- a/plugins/user-interface/tests/defaults.test.mjs +++ b/plugins/user-interface/tests/defaults.test.mjs @@ -40,6 +40,7 @@ const CONTRACT = { gesture: { velocity_threshold: 0.11, distance_threshold: 0.4 }, }, components: { primitives_default: "base-ui" }, + typography: { long_form_body_px: 18 }, }; test("the shipped defaults hold the contract's layer-1 values", () => { @@ -85,6 +86,19 @@ test("the nested-radius gap limit takes an integer of at least 0 and keeps 24 ot assert.deepEqual(gapWith("1.5"), { gap: 24, error_keys: ["css.concentric_radius.max_gap_px"] }); }); +// Expected values: the key's contract, an integer of at least 16 (the body floor) with default 18. +test("the long-form reading size takes an integer of at least 16 and keeps 18 otherwise", () => { + assert.equal(schema.properties.typography.properties.long_form_body_px.minimum, 16); + const sizeWith = (raw) => { + const { values, layers } = resolve({ plugin: "user-interface", projectRoot: PLUGIN, home: "no-such-home", schema, defaults, userConfig: { typography_long_form_body_px: raw }, teamOnly: ["routing"], userHome: join(PLUGIN, "no-such-user") }); + return { size: values.typography.long_form_body_px, error_keys: layers[1].error_keys }; + }; + assert.deepEqual(sizeWith("20"), { size: 20, error_keys: [] }); + assert.deepEqual(sizeWith("16"), { size: 16, error_keys: [] }); + assert.deepEqual(sizeWith("15"), { size: 18, error_keys: ["typography.long_form_body_px"] }); + assert.deepEqual(sizeWith("18.5"), { size: 18, error_keys: ["typography.long_form_body_px"] }); +}); + // Expected values: the exit factor's contract, a fraction from 0 to 1 with default 0.8. test("the exit factor takes a fraction from 0 to 1 and keeps 0.8 otherwise", () => { const factorWith = (raw) => { diff --git a/plugins/user-interface/tests/detect.test.mjs b/plugins/user-interface/tests/detect.test.mjs index 6dfdf805cef..20622f94767 100644 --- a/plugins/user-interface/tests/detect.test.mjs +++ b/plugins/user-interface/tests/detect.test.mjs @@ -181,6 +181,7 @@ describe("--config", () => { gesture: { velocity_threshold: 0.11, distance_threshold: 0.4 }, }, components: { primitives_default: "base-ui" }, + typography: { long_form_body_px: 18 }, routing: { version: 1, deny: ["superdesign"] }, }); }); @@ -224,6 +225,7 @@ describe("--config", () => { "animation.gesture.velocity_threshold": "defaults", "animation.gesture.distance_threshold": "defaults", "components.primitives_default": "defaults", + "typography.long_form_body_px": "defaults", routing: "team", }); });