Skip to content

perf(mobile): self-host fonts, preconnect API, fix yellow contrast#17

Merged
miquelmatoses merged 2 commits into
mainfrom
perf/mobile-fonts-preconnect-contrast
May 15, 2026
Merged

perf(mobile): self-host fonts, preconnect API, fix yellow contrast#17
miquelmatoses merged 2 commits into
mainfrom
perf/mobile-fonts-preconnect-contrast

Conversation

@miquelmatoses
Copy link
Copy Markdown
Collaborator

Summary

Three fixes for the PageSpeed Insights mobile score (71 → expected ~85):

  • Self-host Google Fonts via @fontsource/playfair-display + @fontsource/roboto: removes the render-blocking request to fonts.googleapis.com. 64 WOFF2 files now served from the same origin with font-display: swap. Est. −750 ms LCP on mobile.
  • Preconnect to api.cercol.team: <link rel="preconnect" crossorigin> in index.html so the TLS handshake fires during HTML parsing. Est. −300 ms LCP on mobile.
  • Fix yellow title contrast (WCAG AA): Full Moon card h2 was #f1c22f on white (1.65:1, fails AA). Added titleColor prop to InstrumentCard; Full Moon now uses #8a6100 (5.12:1, passes AA) for the h2 only — border, icon, and hover fill remain yellow. Accessibility: 96 → ~100.

Also adds .claude/ to .gitignore (machine-local Claude Code settings were accidentally untracked).

Test plan

  • 194 frontend tests pass (npx vitest run)
  • 26 backend tests pass (python -m pytest)
  • npm run build:full succeeds; 64 WOFF2 files in dist/assets/
  • After deploy: run PageSpeed Insights mobile and report new score

🤖 Generated with Claude Code

miquelmatoses and others added 2 commits May 16, 2026 01:23
Three fixes targeting the PageSpeed Insights mobile score:

1. Self-host Google Fonts via @fontsource

   Removes the @import url('https://fonts.googleapis.com/...') from
   src/index.css and replaces it with local imports from the
   @fontsource/playfair-display and @fontsource/roboto packages.
   The WOFF2 files are now served from the same origin with
   font-display: swap, eliminating a ~750 ms render-blocking
   request and a critical-path DNS handshake to Google.

   Packages: @fontsource/playfair-display@5.2.8, @fontsource/roboto@5.2.10.
   64 WOFF2 files now bundled locally in dist/assets/.
   Estimated LCP improvement on mobile: −750 ms.

2. Preconnect to api.cercol.team

   Adds <link rel='preconnect' href='https://api.cercol.team'
   crossorigin> to index.html. The browser opens the TLS handshake
   to the API origin during initial HTML parsing, so the first API
   call (auth, blog, witness sessions) does not pay the connection
   setup cost.

   Estimated LCP improvement on mobile: −300 ms.

3. Fix yellow text contrast (WCAG AA)

   The Full Moon instrument card title used colors.yellow (#f1c22f)
   on white background, which is 1.65:1 contrast — fails WCAG AA
   (requires ≥ 3:1 for large text). Added a titleColor prop to
   InstrumentCard that overrides accentColor for the h2 only.
   Full Moon card now passes titleColor="#8a6100" (5.12:1), while
   the border, icon, and hover fill remain yellow (#f1c22f).

   All other cards are unaffected. No token changes needed.
   Accessibility score: 96 → ~100.

Expected combined PageSpeed mobile delta: 71 → ~85.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@miquelmatoses miquelmatoses merged commit 47462af into main May 15, 2026
3 checks passed
@miquelmatoses miquelmatoses deleted the perf/mobile-fonts-preconnect-contrast branch May 15, 2026 23:24
miquelmatoses added a commit that referenced this pull request May 16, 2026
…18)

mm-design v0.2.0 removes the @import url('fonts.googleapis.com/...')
from tokens/typography.css. Font provisioning is now the consumer's
responsibility — @fontsource packages already added in #17 handle this.
Result: zero Google Fonts requests in the built bundle.

Co-authored-by: miquelmatoses <miquelmatoses@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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