Fix chat panel scroll: replace scrollIntoView with container.scrollTo
scrollIntoView walks up the DOM and scrolls every ancestor, including the panel with overflow:hidden — this pushed the header and messages area off-screen after long LLM responses. Using container.scrollTo limits scrolling to only the messages div.
This commit is contained in:
parent
5db321c8e3
commit
70efde8aa6
@ -197,9 +197,14 @@ export default function ChatWidget() {
|
||||
const activeConv = getActiveConversation();
|
||||
const messages = activeConv?.messages ?? [];
|
||||
|
||||
// Auto-scroll on new messages
|
||||
// Auto-scroll on new messages — use direct scrollTop instead of scrollIntoView
|
||||
// because scrollIntoView walks up the DOM and scrolls ALL ancestors (including
|
||||
// the panel with overflow:hidden), which pushes the header off-screen.
|
||||
useEffect(() => {
|
||||
messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });
|
||||
const container = messagesEndRef.current?.parentElement;
|
||||
if (container) {
|
||||
container.scrollTo({ top: container.scrollHeight, behavior: 'smooth' });
|
||||
}
|
||||
}, [messages.length, streaming]);
|
||||
|
||||
// Focus input when panel opens
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user