From 7a07e8d56b47d07afa63f4de5e40f3d7652efd5e Mon Sep 17 00:00:00 2001 From: lyzno1 Date: Wed, 10 Sep 2025 23:45:34 +0800 Subject: [PATCH] Fix auto-scroll for page-level scrolling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace container scrollTop logic with scrollIntoView API to support page-level scroll bars instead of internal container scrolling. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- app/components/index.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/components/index.tsx b/app/components/index.tsx index 8f610f2..b582476 100644 --- a/app/components/index.tsx +++ b/app/components/index.tsx @@ -179,9 +179,15 @@ const Main: FC = () => { const [chatList, setChatList, getChatList] = useGetState([]) const chatListDomRef = useRef(null) useEffect(() => { - // scroll to bottom - if (chatListDomRef.current) - chatListDomRef.current.scrollTop = chatListDomRef.current.scrollHeight + // scroll to bottom with page-level scrolling + if (chatListDomRef.current) { + setTimeout(() => { + chatListDomRef.current?.scrollIntoView({ + behavior: 'auto', + block: 'end', + }) + }, 50) + } }, [chatList, currConversationId]) // user can not edit inputs if user had send message const canEditInputs = !chatList.some(item => item.isAnswer === false) && isNewConversation