fix: lay out every file card

With content-visibility: auto an off-screen card took a 320px
placeholder, so the links of the card above were drawn over its own and
Lighthouse failed target-size on the PS2 page (31 links on desktop, 7
on mobile). Laying out every card moved no Lighthouse metric: TBT stays
at 0 ms on the PS2 and Project64 pages, mobile.
This commit is contained in:
Abdessamad Derraz committed 2026-11-19 18:42:55 +01:00
1 parent 7e4192870f
commit 3eb5d1fce1
2 files changed
+11 -7

No files matched your search

+5 -2
View File
@@ -183,8 +183,11 @@ class ThemeStylesheet(unittest.TestCase):
def test_card_pages(self):
cards = next(b for s, b in _blocks(self.css) if s == ".sl-markdown-content :is(.rb-sys-file, .rb-file-entry)")
self.assertIn("content-visibility: auto", cards)
self.assertIn("contain-intrinsic-size: auto 320px", cards)
# A card off screen with content-visibility kept a placeholder
# height, and the links of the card above were drawn over its own
# (Lighthouse target-size, 31 links on the PS2 page, desktop).
self.assertNotIn("content-visibility", cards)
self.assertNotRegex(self.css, r"content-visibility\s*:")
self.assertIn("--sl-content-width: var(--rb-grid-width)", _rules(self.css, "body:has(.rb-sys-file, .rb-file-entry)")[0])
self.assertEqual(_theme_tokens(self.css, ":root")["--rb-grid-width"], "54rem")
facts = _rules(self.css, "dl.rb-facts")[0]