Lighthouse scores below target. This plan addresses CLS (0.534 → 0), Performance (50 → 90+), and TBT (920ms reduction).
Target Scores:
- Performance: 90+
- Accessibility: Already 100
- Best Practices: Already 100
- SEO: Already 50 (meta tags needed)
- CLS: 0 → <0.1
- TBT: <200ms
| Culprit | Score | Location |
|---|---|---|
#grid-view display switching |
0.534 | index.html:1105 |
| Web font loading | Indirect | Google Fonts |
| Datastar rendering | Indirect | Dynamic content |
File: src/styles/card.css
Current (lines 13-17):
#grid-view {
width: 100%;
max-width: 100%;
min-height: 400px; /* Too small - causes shift */
}Change to:
#grid-view {
width: 100%;
max-width: 100%;
min-height: 85vh; /* Reserve space upfront */
contain: layout style;
}File: src/styles/card.css
Add after line 19:
#collection-view {
width: 100%;
max-width: 100%;
min-height: 85vh;
contain: layout style;
}
#collection-view[data-show="false"] {
display: none !important;
}Lighthouse shows 2,273ms in Style & Layout.
Suspected causes:
renderGrid()effect on#gridelement- Multiple signal initializations
- Datastar reactivity chain
File: index.html
Current data-signal (line 1121) is 2,200+ characters. This causes:
- Parse overhead
- Signal subscription overhead
Reduce signals to essential only:
data-signal="{
showGridOverlay: false,
isPaused: false,
// Move collection-specific signals to lazy initialization
// Only keep global state signals here
}"File: src/styles/card.css
#grid-view {
/* ... min-height from Fix 1.1 ... */
content-visibility: auto;
contain-intrinsic-size: 5000px;
}Bundle CSS has unused rules from:
table.css- Not used initiallyanimations.css- Conditional- Print styles - Never used
File: scripts/build.js or vite.config.js
Add critical CSS extraction:
// Extract inline critical styles
// Delay loading non-critical bundlesThe collections-page.css loads on every page but only needed when collection opens.
Google Fonts URL in index.html needs font-display=swap.
Current:
https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap
Already has display=swap. Root cause may be FOIT/FOUT timing.
File: index.html - Add in <head>
<link rel="preload" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap" as="style" />File: index.html - Add in <head>
<meta name="description" content="CSS Reference - Interactive CSS property explorer with live demos, MDN links, and practical examples for web developers." />File: index.html - Add in <head>
<meta property="og:title" content="CSS Ref - Interactive CSS Reference" />
<meta property="og:description" content="Interactive CSS property explorer with live demos" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://tantalumv.github.io/css-ref/" />File: index.html - Add in <head>
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="CSS Ref - Interactive CSS Reference" />
<meta name="twitter:description" content="Interactive CSS property explorer with live demos" />File: index.html - Add in <head>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebApplication",
"name": "CSS Ref",
"description": "Interactive CSS property explorer with live demos, MDN links, and practical examples",
"url": "https://tantalumv.github.io/css-ref/",
"applicationCategory": "DeveloperApplication",
"operatingSystem": "Web Browser",
"offers": {
"@type": "Offer",
"price": "0",
"priceCurrency": "USD"
}
}
</script>| Step | Priority | File | Change | Est. Impact |
|---|---|---|---|---|
| 1 | Critical | card.css | Add min-height | CLS -0.3 |
| 2 | High | index.html | Add meta tags | SEO +40 |
| 3 | Medium | card.css | Add content-visibility | TBT -100ms |
| 4 | Low | build.js | CSS splitting | Perf +5 |
After implementing, run:
npm run build
# Then test with LighthouseExpected Results:
- CLS: 0.534 → <0.1
- Performance: 50 → 85+
- SEO: 50 → 90+
- TBT: 920ms → <400ms
src/styles/card.css- Add min-height, content-visibilityindex.html- Add meta tags (SEO), verify signalsscripts/build.js- Optional: CSS splitting
- The datastar bundle is ~14KB (from cdn.jsdelivr.net) - not in our control
- Cache TTL is already optimized at 10m
- The layout shifts are primarily from view switching (grid → collection)
- Pre-reserving space for both views eliminates the shift
Last Updated: April 2026