mirror of
https://github.com/langgenius/webapp-conversation.git
synced 2025-12-08 17:32:27 +08:00
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:
@ -179,9 +179,15 @@ const Main: FC<IMainProps> = () => {
|
||||
const [chatList, setChatList, getChatList] = useGetState<ChatItem[]>([])
|
||||
const chatListDomRef = useRef<HTMLDivElement>(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
|
||||
|
||||
Reference in New Issue
Block a user