ory / ory/docs

Font loading causes Cumulative Layout Shift (CLS)

Open
#2,409 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
161
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

Preflight checklist
Ory Network Project

No response

Describe the bug

The docs site experiences layout shift when custom fonts load because the fallback fonts (sans-serif, monospace) have different metrics than our web fonts (Inter, JetBrains Mono). This causes visible "jank" as text reflows when fonts swap in.

This seems to negatively impact Core Web Vitals CLS score.

Reproducing the bug
PageSpeed Insights
  1. Go to PageSpeed Insights - /kratos/bring-your-own-ui/custom-ui-advanced-integration
  2. Enter the docs URL
  3. Click on Desktop tab
  4. Scroll down and click Layout shift culprits to expand
Chrome DevTools Performance Tab
Image Image
Relevant log output

Relevant configuration

Version

1.0.0

On which operating system are you observing this issue?

None

In which environment are you deploying?

None

Additional Context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the /kratos/bring-your-own-ui/custom-ui-advanced-integration URL in PageSpeed Insights, then inspect the reported layout-shift culprits in Chrome DevTools' Performance tab. Done means the custom font loading no longer causes the reported visible text reflow and the page's CLS improves.

Written by the indexing model from the issue text.

Assessment

Domain
documentation, performance
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.