From 57af6dd320a4746166ea4ebec884755dddb6eee4 Mon Sep 17 00:00:00 2001 From: staviq Date: Wed, 16 Aug 2023 23:19:55 +0200 Subject: [PATCH] sync accepted #2409 fix from upstream --- examples/server/public/index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/server/public/index.html b/examples/server/public/index.html index 0d1c6bf09..a9bc3bdf4 100644 --- a/examples/server/public/index.html +++ b/examples/server/public/index.html @@ -414,9 +414,9 @@ useEffect(() => { // scroll to bottom (if needed) - let scrollable = document.querySelector('#content'); - if (scrollable && scrollable.scrollHeight <= scrollable.scrollTop + scrollable.offsetHeight + 300) { - scrollable.scrollTo(0, scrollable.scrollHeight) + const parent = container.current.parentElement; + if (parent && parent.scrollHeight <= parent.scrollTop + parent.offsetHeight + 300) { + parent.scrollTo(0, parent.scrollHeight) } }, [messages])