question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Font-Display check should consider icon fonts

See original GitHub issue

Feature request summary A special check to not recommend font-display: swap for icon fonts.

What is the motivation or use case for changing this?

There seems to be no clear recommendation on what is actually best practice for icon fonts, and even if there is, it’s not swap but actually block. So I would suggest either adding a special rule to to detect icon fonts or maybe whitelist the most common ones so they don’t trigger the lighthouse warning when swap is not set.

Relevant links:

How is this beneficial to Lighthouse?

Currently the Lighthouse recommendation is not actual the best practice and might cause people blindly following it to get unintended behaviour.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:6
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
patrickhulcecommented, Dec 18, 2019

Thanks for filing @Stanzilla!

so they don’t trigger the lighthouse warning when swap is not set.

The Lighthouse audit is not looking for swap it’s looking for any valid font-display value that’s not the default. If you follow icon font best practices and use block, the audit will pass.

The Learn More docs are misleading on this point, so we’ll update those 👍

0reactions
yisiblcommented, Mar 20, 2021

@PatOnTheBack A digression, is there any tool to test and compare the performance of svg and font icons?

Read more comments on GitHub >

github_iconTop Results From Across the Web

font-display is Incompatible with Icon Fonts—zachleat.com
The main point that I think hasn't really been communicated enough is that icon fonts exist in a place that would seem to...
Read more >
Correct font-display value for icon fonts - Stack Overflow
It would be the perfect thing for something like icon fonts where the icon (probably) has no meaning unless the custom font loads....
Read more >
Best practices for fonts - web.dev
If ensuring text is displayed in a web font is a top priority: Use font-display: block but make sure to deliver the font...
Read more >
Seriously, Don't Use Icon Fonts - Cloud Four
Most assistive devices will read aloud text inserted via CSS, and many of the Unicode characters icon fonts depend on are no exception....
Read more >
font-display | CSS-Tricks
The font-display property defines how font files are loaded and displayed by the browser. It is applied to the @font-face rule which defines ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found