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