Skip to content

feat(#137): migrate root font sizing — remove 62.5% override, divide rem by 1.6 - #186

Closed
jenil wants to merge 1 commit into
v1from
work/137-root-font
Closed

jenil wants to merge 1 commit into
v1from
work/137-root-font

Conversation

@jenil

@jenil jenil commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Summary

Migrates Chota's root font sizing so it no longer sets html { font-size: 62.5% }, removing the forced 1rem = 10px override that broke accessibility zoom and consumer root overrides. Every Chota-owned rem value is divided by 1.6 so rendered pixels are unchanged at a 16px consumer root.

Closes #137.

What changed

Source (35 rem tokens across 6 files):

  • src/_base.css: --grid-maxWidth 120rem→75rem, --grid-gutter 2rem→1.25rem, --font-size 1.6rem→1rem; removed font-size: 62.5% from html; added a source comment explaining Chota does not set the root font-size; converted blockquote/hr/td,th/pre padding+margin.
  • src/_card.css, src/_form.css, src/_nav.css, src/_tab.css, src/_tag.css: padding/margin/width/height/letter-spacing rem tokens converted.

Untouched (no rem): src/_dropdown.css, src/_grid.css (uses var(--grid-gutter)), src/_util.css, src/chota.css. All em/%/px/vh values unchanged — em-based typography (h1–h6, .tag.is-small/.is-large, .nav .brand, code/kbd) stays relative to the body font-size, which remains 16px.

Documentation:

  • MIGRATION.md: new "Root Font-Size Migration" section (what/why/consumer impact/reference table/em-typography note).
  • docs/index.html: updated the two Customizing code blocks and added a sentence stating Chota does not set the root font-size.

Build:

Consumer impact

  • Did NOT override the root: no visual change. Body font-size still 16px (--font-size: 1rem at 16px root = 16px, same as old 1.6rem at 10px root = 16px).
  • Set html { font-size: 62.5% }: Chota now renders at 0.625× its 16px-root size (proportional scaling, not a second baseline).
  • Set a different root (e.g. 20px): Chota scales proportionally to that root.
Property Before After Rendered px (16px root)
--grid-maxWidth 120rem 75rem 1200px (unchanged)
--grid-gutter 2rem 1.25rem 20px (unchanged)
--font-size 1.6rem 1rem 16px (unchanged)

Validation

  • yarn build: PASS — stylelint clean, postcss, size-gate 3373 bytes (baseline: 3373, ceiling: 4096) → PASS: Within baseline and ceiling. (exit 0)
  • yarn test:api: PASS — 5/5 on Chromium (exit 0). api-manifest.json records names only and the names are unchanged; manifest not edited.
  • grep "62.5%" dist/chota.css: empty (override removed).
  • grep "0.625rem" dist/chota.css: matches present (conversion applied).
  • git diff --check: clean (no whitespace errors).

Size impact

Metric Before After Δ
dist/chota.css bytes 18733 19039 +306
dist/chota.min.css bytes 14353 14419 +66
gzip bytes 3372 3373 +1

The +1 gzip byte comes from marginally longer decimal tokens (e.g. 0.625rem vs 1rem). Well within the 4096-byte ceiling; budget remaining: 723 bytes.

Scope

  • Base: v1 @ 980c1f4
  • Branch: work/137-root-font
  • Commit: f2c1102
  • 11 files changed, 99 insertions(+), 67 deletions(-)
  • No changes to excluded files: AGENTS.md, PLAN.md, test/AGENTS.md, playwright.config.js, package.json, .stylelintrc, postcss.config.js, test/vrt/api-manifest.json, test/vrt/*.spec.js, src/_dropdown.css, src/_grid.css, src/_util.css, src/chota.css.

…rem by 1.6

Chota previously set `html { font-size: 62.5% }`, which forced `1rem = 10px`
and overrode the consumer's root font-size, breaking accessibility zoom and
consumer overrides. This removes the override and divides every Chota-owned
rem value by 1.6 so rendered pixels are unchanged at a 16px consumer root.

Source changes (35 rem tokens across 6 files):
- src/_base.css: --grid-maxWidth 120rem->75rem, --grid-gutter 2rem->1.25rem,
  --font-size 1.6rem->1rem; removed `font-size: 62.5%` from html; added a
  source comment explaining Chota does not set the root font-size;
  blockquote/hr/td,th/pre padding+margin converted.
- src/_card.css, src/_form.css, src/_nav.css, src/_tab.css, src/_tag.css:
  padding/margin/width/height/letter-spacing rem tokens converted.

Untouched (no rem): src/_dropdown.css, src/_grid.css (uses var(--grid-gutter)),
src/_util.css, src/chota.css. All em/%/px/vh values unchanged — em-based
typography (h1-h6, .tag.is-small/large, .nav .brand, code/kbd) stays relative
to the body font-size, which remains 16px.

Documentation:
- MIGRATION.md: new "Root Font-Size Migration" section with what/why/consumer
  impact/reference table/em-typography note.
- docs/index.html: updated the two Customizing code blocks (120rem->75rem,
  2rem->1.25rem, 1.6rem->1rem, 108rem->67.5rem) and added a sentence stating
  Chota does not set the root font-size.

Build + size gate:
- dist/chota.css and dist/chota.min.css regenerated.
- gzip size: 3372 -> 3373 bytes (+1 byte, from marginally longer decimal
  tokens). Within the 4096-byte ceiling. baselines/size-baseline.json
  updated with new gzip_bytes (3373), gzip_budget_remaining_bytes (723),
  dist byte counts, and a #137 rationale entry.

Validation:
- yarn build: PASS (stylelint clean, postcss, size-gate 3373/3373/4096).
- yarn test:api: PASS (5/5, Chromium) — api-manifest.json records names only
  and the names are unchanged; manifest not edited.
jenil added a commit that referenced this pull request Aug 9, 2026
…rem by 1.6 (#188)

* feat(#137): migrate root font sizing — remove 62.5% override, divide rem by 1.6

Chota previously set `html { font-size: 62.5% }`, which forced `1rem = 10px`
and overrode the consumer's root font-size, breaking accessibility zoom and
consumer overrides. This removes the override and divides every Chota-owned
rem value by 1.6 so rendered pixels are unchanged at a 16px consumer root.

Source changes (35 rem tokens across 6 files):
- src/_base.css: --grid-maxWidth 120rem->75rem, --grid-gutter 2rem->1.25rem,
  --font-size 1.6rem->1rem; removed `font-size: 62.5%` from html; added a
  source comment explaining Chota does not set the root font-size;
  blockquote/hr/td,th/pre padding+margin converted.
- src/_card.css, src/_form.css, src/_nav.css, src/_tab.css, src/_tag.css:
  padding/margin/width/height/letter-spacing rem tokens converted.

Untouched (no rem): src/_dropdown.css, src/_grid.css (uses var(--grid-gutter)),
src/_util.css, src/chota.css. All em/%/px/vh values unchanged — em-based
typography (h1-h6, .tag.is-small/large, .nav .brand, code/kbd) stays relative
to the body font-size, which remains 16px.

Documentation:
- MIGRATION.md: new "Root Font-Size Migration" section with what/why/consumer
  impact/reference table/em-typography note.
- docs/index.html: updated the two Customizing code blocks (120rem->75rem,
  2rem->1.25rem, 1.6rem->1rem, 108rem->67.5rem) and added a sentence stating
  Chota does not set the root font-size.

Build + size gate:
- dist/chota.css and dist/chota.min.css regenerated.
- gzip size: 3372 -> 3373 bytes (+1 byte, from marginally longer decimal
  tokens). Within the 4096-byte ceiling. baselines/size-baseline.json
  updated with new gzip_bytes (3373), gzip_budget_remaining_bytes (723),
  dist byte counts, and a #137 rationale entry.

Validation:
- yarn build: PASS (stylelint clean, postcss, size-gate 3373/3373/4096).
- yarn test:api: PASS (5/5, Chromium) — api-manifest.json records names only
  and the names are unchanged; manifest not edited.

* test(#137): add 10px/16px root-font scaling proof, update fixture/spec comments

D3 test/fixture changes for card #137 (migrate root font sizing without
visual regression). D2 already removed html { font-size: 62.5% } and
divided all Chota rem tokens by 1.6 (commit f2c1102, PR #186).

Tasks:
- Convert inline .demo-label rem values in two validation fixtures
  (mobile-grid-overflow.html, nav-logo-full-height.html) by /1.6 to
  preserve rendered intent at a 16px consumer root.
- Update stale spec comments in index.spec.js and components.spec.js to
  cite the new source rem values (1rem = 16px consumer root). Comments
  only — no expect() assertion values changed; rendered pixels at 16px
  root are unchanged.
- Add test/vrt/root-font-scaling.spec.js: 3 computed-style tests proving
  (1) 16px root matches design intent, (2) 10px root scales every
  rem-derived property by 0.625, (3) the 10px/16px ratio is exactly 0.625
  for pure-rem properties. No toMatchSnapshot (card forbids a second
  baseline). Not wired into test:vrt (shared package.json config requires
  owner approval).
- Document the new spec in test/vrt/README.md.

Evidence:
- yarn build: no-op (dist size 3373 = baseline).
- npx playwright test test/vrt/root-font-scaling.spec.js --project=chromium:
  3 passed.
- yarn test:a11y: 4 passed (axe-core rules unaffected by rem).
- mobile-grid-overflow.spec.js: 4 passed.

Known follow-up (out of scope for this card's Task 1 brief, reported to
coordinator): nav-logo-full-height.spec.js has 10 screenshot baseline
failures caused by fixture-authored inline style="min-height: 3rem/4rem/
6rem" (13 occurrences) and one style="margin: 0 0.5rem" that were
authored against the old 10px root and are not divided by 1.6. These are
NOT Chota source tokens (D2's source migration is correct) and are NOT
the .demo-label values converted here. Probe confirmed converting them
makes all 15 nav-logo tests pass without baseline regeneration. Recommend
a separate implementation card to convert those fixture-authored rem
values.

* test(#137): convert fixture-authored inline rem values in nav-logo-full-height.html (÷1.6)

14 inline style rem values (min-height: 3rem/4rem/6rem, margin: 0 0.5rem) were
authored against the old 10px root scale. After D2's root-font migration they
rendered at 1.6× their intended size, causing 10 nav-logo-full-height.spec.js
screenshot baseline failures. Converting them by 1.6 preserves the rendered
pixels at a 16px consumer root and restores yarn test:vrt to 100 passed.

Coordinator scope correction: D3's brief limited this fixture edit to the
.demo-label inline style; the full inline-rem conversion is necessary for
VRT to be green and is part of the #137 root-font migration (same invariant).
@jenil

jenil commented Aug 11, 2026

Copy link
Copy Markdown
Owner Author

Closing — superseded by #188. This PR contained only the D2 (CSS source) half of #137. The complete change (D2 CSS + D3 tests/fixtures + the nav-logo-full-height.html inline-rem fixture conversions needed for VRT to pass) was merged as #188, which targets v1 directly with the full work/137-root-font-tests branch. #137 is complete (merge SHA 9b9aee0).

@jenil jenil closed this Aug 11, 2026
@jenil
jenil deleted the work/137-root-font branch August 11, 2026 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant