Skip to content

Font loading causes Cumulative Layout Shift (CLS) #2409

Description

@jaygiang

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is not working.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions