fix(ui): wait for the icon font itself before revealing Material Symbols
`document.fonts.ready` resolved before the 4MB Material Symbols woff2 even started loading — it runs in <head>, ahead of any element that would trigger the lazy fetch. The `fonts-loaded` class landed early, so icons rendered blank until a second load served the font from disk cache. Load the face explicitly and swap visibility for opacity, with a 3s fallback so icons never stay hidden if the font fails. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -34,7 +34,7 @@ export default function RootLayout({ children }) {
|
||||
<head>
|
||||
<script
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `if(document.fonts&&document.fonts.ready){document.fonts.ready.then(function(){document.documentElement.classList.add('fonts-loaded')})}else{document.documentElement.classList.add('fonts-loaded')}`,
|
||||
__html: `var d=document,r=d.documentElement,f=function(){r.classList.add('fonts-loaded')};if(d.fonts&&d.fonts.load){d.fonts.load('24px "Material Symbols Outlined"').then(f).catch(f);setTimeout(f,3000)}else{f()}`,
|
||||
}}
|
||||
/>
|
||||
</head>
|
||||
|
||||
Reference in New Issue
Block a user