T45c Site · Home: full screen locks the page's overflow and Lenis halts on it, ending a glide in flight

This commit is contained in:
ZacharyZhang-NY committed 2026-10-01 08:38:05 -04:00
1 parent e2b9670043
commit c3f9cd533a
2 files changed
+5 -4

No files matched your search

+3 -3
View File
@@ -47,11 +47,11 @@ export function Live({ page, story, title }: { page: string; story: string; titl
useEffect(() => {
if (!full) return;
document.body.style.overflow = "hidden";
document.documentElement.style.overflow = "hidden";
const escape = (event: KeyboardEvent) => event.key === "Escape" && setFull(false);
addEventListener("keydown", escape);
return () => {
document.body.style.overflow = "";
document.documentElement.style.overflow = "";
removeEventListener("keydown", escape);
};
}, [full]);
@@ -61,7 +61,7 @@ export function Live({ page, story, title }: { page: string; story: string; titl
<button className="skip-live" onClick={() => after.current?.focus()}>
Skip the live example
</button>
<div className={full ? "live full" : "live"} data-lenis-prevent={full || undefined}>
<div className={full ? "live full" : "live"}>
<iframe key={run} ref={frame} title={`${title}, live`} src={src(start)} />
{state !== "ready" && (
<div className="live-state" role="status">
+2 -1
View File
@@ -61,7 +61,8 @@ export function Shell() {
const router = useRouter();
useEffect(() => {
if (still) return;
const lenis = new Lenis({ autoRaf: true });
// It halts while the page's overflow is hidden, as full screen sets.
const lenis = new Lenis({ autoRaf: true, autoToggle: true });
// A glide in flight must not outlive its page.
const off = router.subscribe("onBeforeNavigate", () => lenis.scrollTo(lenis.animatedScroll, { immediate: true, force: true }));
return () => {