fix firefox autoscroll (#2519)

This commit is contained in:
Jonas Wunderlich 2023-08-04 20:16:11 +00:00 committed by GitHub
parent 182af739c4
commit 332311234a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 556 additions and 556 deletions

File diff suppressed because it is too large Load diff

View file

@ -282,8 +282,9 @@
useEffect(() => { useEffect(() => {
// scroll to bottom (if needed) // scroll to bottom (if needed)
if (container.current && container.current.scrollHeight <= container.current.scrollTop + container.current.offsetHeight + 300) { const parent = container.current.parentElement;
container.current.scrollTo(0, container.current.scrollHeight) if (parent && parent.scrollHeight <= parent.scrollTop + parent.offsetHeight + 300) {
parent.scrollTo(0, parent.scrollHeight)
} }
}, [messages]) }, [messages])