diff options
author | Jonas Wunderlich <32615971+jonas-w@users.noreply.github.com> | 2023-08-04 20:16:11 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-04 22:16:11 +0200 |
commit | 332311234a0aa2974b2450710e22e09d90dd6b0b (patch) | |
tree | 341a9273591dc438a46ef4a9dd7d637677b9eace /examples/server/public/index.html | |
parent | 182af739c4ce237f7579facfe8f94dc53a1f573f (diff) |
fix firefox autoscroll (#2519)
Diffstat (limited to 'examples/server/public/index.html')
-rw-r--r-- | examples/server/public/index.html | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/server/public/index.html b/examples/server/public/index.html index 1db69a6..de41da1 100644 --- a/examples/server/public/index.html +++ b/examples/server/public/index.html @@ -282,8 +282,9 @@ useEffect(() => { // scroll to bottom (if needed) - if (container.current && container.current.scrollHeight <= container.current.scrollTop + container.current.offsetHeight + 300) { - container.current.scrollTo(0, container.current.scrollHeight) + const parent = container.current.parentElement; + if (parent && parent.scrollHeight <= parent.scrollTop + parent.offsetHeight + 300) { + parent.scrollTo(0, parent.scrollHeight) } }, [messages]) |