diff options
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]) |