Chat panel follows its tail by scrolling its own body (SidePanel body gets data-slot side-panel-body) instead of scrollIntoView, which scrolls every ancestor

This commit is contained in:
2026-10-16 10:50:23 +02:00
parent cb377ba00e
commit 9d9dac0bd0
2 changed files with 5 additions and 1 deletions
+4 -1
View File
@@ -179,7 +179,10 @@ export function ChatPanel() {
const tailLength = tail && "text" in tail ? tail.text.length : 0
// biome-ignore lint/correctness/useExhaustiveDependencies: scroll when the list or a streamed answer grows, not on every render.
useEffect(() => {
bottom.current?.scrollIntoView({ block: "end" })
// Only the panel's body moves: `scrollIntoView` would scroll every
// ancestor too, which is how the logs panel slid the code editor away.
const body = bottom.current?.closest("[data-slot=side-panel-body]")
body?.scrollTo({ top: body.scrollHeight })
}, [shown.length, tailLength, waiting])
const send = async () => {
@@ -252,6 +252,7 @@ export function SidePanel({
</div>
<div
data-slot="side-panel-body"
className={cn(
"flex min-h-0 flex-1 flex-col",
expanded ? "overflow-hidden" : "overflow-y-auto",