Font loading performance and Cumulative Layout Shift

I just sent basically this as an email to my team, but since I think this is very interesting (to web experience & performance geeks) I’m gonna quickly throw it up as a post:

I just read More than you ever wanted to know about font loading on the web (which I found on Hacker News).

Font loading CLS

This article is all about how best to load fonts. It looks like just another dude’s opinion but it’s actually got a really impressive depth of knowledge behind it.

Summary

I really recommend reading the whole article, but here are the important points:

Use "font-display: optional"

Long before Web Vitals came along, I was always quite frustrated at how fonts load on ubuntu.com - being invisible on first load, or swapping fonts in the first second - and it is far from the worst offender.

font-display: optional sounds like the perfect compromise between performance & user interests, and the desire to present elegant professional designs. It doesn’t slow down the user unnecessarily, but will lead to most people getting the best experience most of the time.

Browser no longer share caches

I learned something else quite interesting from this article, although it’s actually news from over a year ago:

I was aware that performance gurus had stopped recommending linking directly to shared file host CDNs like fonts.google.com, but I assumed it was because someone had noticed that people rarely actually had these files cached in practice (which is probably true).

In fact there’s a much more solid reason: browsers no longer shared caches between domains. This is because it opens up users to fingerprinting attacks, and it means that the stated benefit of shared CDNs has disappeared - even if someone has previous cached, say, fonts.google.com/ubuntu.woff on a different domain, our domains can’t benefit from that because the browsers forbid it.

By @nottrobin