Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A fix for flash of unstyled font #184

Merged
merged 6 commits into from
Jun 27, 2024
Merged

Conversation

natashapl
Copy link
Contributor

@natashapl natashapl commented Jun 25, 2024

This Pull request will include the following:

  • A possible fix for the flash of unstyled font issue.

PR Preview

@natashapl natashapl linked an issue Jun 25, 2024 that may be closed by this pull request
@natashapl natashapl requested a review from jonathanbobel June 25, 2024 06:20
@natashapl natashapl self-assigned this Jun 25, 2024
@natashapl natashapl requested a review from jonadecker June 25, 2024 06:21
@ethangardner
Copy link
Contributor

Here is before/after with font caching and a preload. I preloaded the heading font only, since that seems to be the most noticeable cause of FOUT. In the tests below, the before is labeled "baseline fout" and the after is "with font preload and cache test."

This is the first view: https://www.webpagetest.org/video/compare.php?tests=240626_BiDcB7_BCV%2C240626_BiDcD8_BD1&thumbSize=200&ival=100&end=visual

FCP is quicker in the before version, but LCP ends up being quicker in the after.

Repeat view: https://www.webpagetest.org/video/compare.php?tests=240626_BiDcB7_BCV-c:1%2C240626_BiDcD8_BD1-c:1&thumbSize=200&ival=100&end=visual

Repeat views will have the most pronounced impact since the fonts will be in cache and don't need to get fetched from the network. In all cases, FOUT from the heading seems to be improved. Ready for review.

jonadecker
jonadecker previously approved these changes Jun 26, 2024
Copy link
Contributor

@jonadecker jonadecker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@jonadecker
Copy link
Contributor

@natashapl / @ethangardner can you please resolve the conflicts on this branch?

@jonadecker jonadecker merged commit 0a63141 into main Jun 27, 2024
3 checks passed
@jonadecker jonadecker deleted the flash-of-unstyled-font-fix branch June 27, 2024 00:07
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.

Spike: Explore better font compilation
3 participants