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.

[Icon] Hide name placeholder while "Material Icons" font is loading

See original GitHub issue

As a current behavior, when you use something like <Icon>lock</Icon> and refresh a page, it’s up to luck if the browser currently has the https://fonts.googleapis.com/icon?family=Material+Icons font cached or not (if you set your developer tools to clear cache on refresh, which may be often needed for development purposes, you may see this artifact occur every single time). This can cause something like “lo” be rendered due to the icon being too small when styled, causing a terrible user experience. I’ve been looking for workarounds, and there’s an option like using a <Icon className={classes.materialIcon}> after const classes = useStyles(); with a following style:

const useStyles = makeStyles(() =>
     createStyles({
         materialIcon: {
           "&:before": {
                content: '""',
            },
         },
     })
 );

However, this may cause additional false positives, as the icon disappears while loading a page even if it’s cached. There’s no mention of this problem within documentation. Is there any correct solution?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
oliviertassinaricommented, Jul 20, 2020

@DanailH It’s a trivial change, the most interesting part is to get through the git repo clone, open pull request, review, merge workflow. IMHO after 1 or 2 good first issues, it’s not worth doing more 😃

1reaction
DanailHcommented, Jul 20, 2020

@oliviertassinari Ok then I would like to give it a try 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Icon] Hide name placeholder while "Material Icons" font is ...
This can cause something like "lo" be rendered due to the icon being too small when styled, causing a terrible user experience. I've...
Read more >
How to prevent material icon text from showing up when ...
If you are using Typekit's webfont loader, you can apply conditional classes to hide the icons while the web font is loading or...
Read more >
Material Icons Guide | Google Fonts
The material icon font is the easiest way to incorporate material icons with web projects. We have packaged all the material icons into...
Read more >
How to avoid layout shifts caused by web fonts - Simon Hearne
One of the biggest causes of layout shifts for my clients is late-loading web fonts, let's look at how to optimise them!
Read more >
Bootstrap Icons - examples & tutorial
Huge collection of over 1500+ responsive icons for Bootstrap 5. A library of well organized and easy to use icons which allow you...
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