Fix auto-scroll for page-level scrolling

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 <noreply@anthropic.com>
This commit is contained in:
lyzno1
2025-09-10 23:45:34 +08:00
parent c907432782
commit 7a07e8d56b

View File

@ -179,9 +179,15 @@ const Main: FC<IMainProps> = () => {
const [chatList, setChatList, getChatList] = useGetState<ChatItem[]>([]) const [chatList, setChatList, getChatList] = useGetState<ChatItem[]>([])
const chatListDomRef = useRef<HTMLDivElement>(null) const chatListDomRef = useRef<HTMLDivElement>(null)
useEffect(() => { useEffect(() => {
// scroll to bottom // scroll to bottom with page-level scrolling
if (chatListDomRef.current) if (chatListDomRef.current) {
chatListDomRef.current.scrollTop = chatListDomRef.current.scrollHeight setTimeout(() => {
chatListDomRef.current?.scrollIntoView({
behavior: 'auto',
block: 'end',
})
}, 50)
}
}, [chatList, currConversationId]) }, [chatList, currConversationId])
// user can not edit inputs if user had send message // user can not edit inputs if user had send message
const canEditInputs = !chatList.some(item => item.isAnswer === false) && isNewConversation const canEditInputs = !chatList.some(item => item.isAnswer === false) && isNewConversation