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

The font-display audit doesn't do what it thinks it does #15771

Open
2 tasks done
tunetheweb opened this issue Jan 21, 2024 · 3 comments
Open
2 tasks done

The font-display audit doesn't do what it thinks it does #15771

tunetheweb opened this issue Jan 21, 2024 · 3 comments
Assignees

Comments

@tunetheweb
Copy link
Member

FAQ

URL

https://almanac.httparchive.org

What happened?

We use font-display: block because that's my preference (I hate the inflation effect of swap and preload the selft-hosted, subsetted fonts so block period is minimal).

The audit passes. The audit, as it's currently titled ("Ensure text remains visible during webfont load") and described ("Leverage the font-display CSS feature to ensure text is user-visible while webfonts are loading. Learn more about font-display.") should fail.

I staged the site without any font-display setting at https://20240121t142255-dot-webalmanac.uk.r.appspot.com/en/2022/ and ran a PSI test on it and now it does fail, with quite large potential savings:

image

It seems the original intent of the audit (#3831) was to recommend swap/optional but it was changed during PR review to include block, but not changed to consider that a fail.

So the audit should be title "Use an explicit font-display value" rather than "Ensure text remains visible during webfont load". Or should be changed to fail if potential savings > some minimal value.

What did you expect?

The audit should fail

What have you tried?

Running same site without font-display set and it fails, even though load time is the exact same (As Chrome defaults to block).

How were you running Lighthouse?

PageSpeed Insights

Lighthouse Version

11.4.0

Chrome Version

Chrome 120

Node Version

No response

OS

N/A

Relevant log output

"font-display": {
      "id": "font-display",
      "title": "All text remains visible during webfont loads",
      "description": "Leverage the `font-display` CSS feature to ensure text is user-visible while webfonts are loading. [Learn more about `font-display`](https://developer.chrome.com/docs/lighthouse/performance/font-display/).",
      "score": 1,
      "scoreDisplayMode": "metricSavings",
      "warnings": [],
      "details": {
        "type": "table",
        "headings": [],
        "items": []
      },
      "guidanceLevel": 3
    },
@tunetheweb
Copy link
Member Author

Related to #10127

@connorjclark
Copy link
Collaborator

connorjclark commented Feb 6, 2024

To make sure we're on the same page...is this a good summary of what should be done?

Change the audit to only fail a font if a) the font-display is block or auto/not set and b) network time is above some threshold

@tunetheweb
Copy link
Member Author

That would work.

By network time do you mean the total font download time? Or the time since it’s needed (I.e. if it delays FCP or LCP)? Ideally if font is downloaded before it’s needed then it wouldn’t fail audit but that could be tricky to figure out.

Might also wanna exclude icon fonts since they should block as per #10127 but not sure how easier it is to identify those.

Also fonts not needed for the above the fold content are another tricky one. Should they cause the audit to fail?

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

No branches or pull requests

5 participants