feat: light a chapter when its heading crosses 60% of the viewport

This commit is contained in:
2026-10-11 01:11:09 +03:00
parent 7fa1c08ce8
commit d6045ad2c1
3 changed files with 13 additions and 6 deletions

View File

@@ -73,9 +73,9 @@ test("passive scrolling replaces a stable fragment without stealing focus", asyn
if (heading === null) throw new Error("Missing experience heading");
const headingDocumentTop =
heading.getBoundingClientRect().top + window.scrollY;
// Place the heading just beyond the 35% activation line. Scroll offsets
// Place the heading just beyond the 60% activation line. Scroll offsets
// are integer-rounded in Chromium, so exact boundary equality is brittle.
window.scrollTo(0, headingDocumentTop - window.innerHeight * 0.34);
window.scrollTo(0, headingDocumentTop - window.innerHeight * 0.59);
});
await expect(page).toHaveURL(`${distUrl}/#experience`, { timeout: 2000 });