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 [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
|
||||||
|
|||||||
Reference in New Issue
Block a user