repl: defer scrollTo via rAF so first-render restored transcript lands at bottom
This commit is contained in:
parent
07033cd96f
commit
e2ebefe0f9
2 changed files with 14 additions and 4 deletions
|
|
@ -287,8 +287,13 @@ function renderAll() {
|
|||
}
|
||||
transcriptEl.appendChild(block);
|
||||
}
|
||||
// Body owns the scroll now; jump it to the latest entry.
|
||||
window.scrollTo({ top: document.documentElement.scrollHeight, behavior: "instant" });
|
||||
// Body owns the scroll now; jump to the bottom after layout settles.
|
||||
// requestAnimationFrame lets the just-mounted DOM contribute to
|
||||
// scrollHeight before we measure — otherwise on first load the page
|
||||
// sticks at the top because the transcript hasn't been laid out yet.
|
||||
requestAnimationFrame(() => {
|
||||
window.scrollTo({ top: document.documentElement.scrollHeight, behavior: "instant" });
|
||||
});
|
||||
}
|
||||
|
||||
// ─── Input handling ─────────────────────────────────────────────────
|
||||
|
|
|
|||
|
|
@ -287,8 +287,13 @@ function renderAll() {
|
|||
}
|
||||
transcriptEl.appendChild(block);
|
||||
}
|
||||
// Body owns the scroll now; jump it to the latest entry.
|
||||
window.scrollTo({ top: document.documentElement.scrollHeight, behavior: "instant" });
|
||||
// Body owns the scroll now; jump to the bottom after layout settles.
|
||||
// requestAnimationFrame lets the just-mounted DOM contribute to
|
||||
// scrollHeight before we measure — otherwise on first load the page
|
||||
// sticks at the top because the transcript hasn't been laid out yet.
|
||||
requestAnimationFrame(() => {
|
||||
window.scrollTo({ top: document.documentElement.scrollHeight, behavior: "instant" });
|
||||
});
|
||||
}
|
||||
|
||||
// ─── Input handling ─────────────────────────────────────────────────
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue