diff options
author | Elizabeth Hunt <lizhunt@amazon.com> | 2025-01-16 17:19:01 -0800 |
---|---|---|
committer | Elizabeth Hunt <lizhunt@amazon.com> | 2025-01-16 17:19:01 -0800 |
commit | b2391b058ba46f807d1ba64f92f4d666adb3abdf (patch) | |
tree | 076c218043997bc5e50c8e273f49dd2fbe5f6aa8 | |
parent | af7206cd6c4e3cd02e4fe653d3d2c9e1e6bc95ca (diff) | |
download | phoneof-b2391b058ba46f807d1ba64f92f4d666adb3abdf.tar.gz phoneof-b2391b058ba46f807d1ba64f92f4d666adb3abdf.zip |
fix
-rw-r--r-- | static/js/components/chat.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/static/js/components/chat.js b/static/js/components/chat.js index 2122064..ad876ad 100644 --- a/static/js/components/chat.js +++ b/static/js/components/chat.js @@ -9,9 +9,10 @@ const runChat = async () => { const { scrollTop, scrollHeight, clientTop } = document.getElementById( "chat-container", ) ?? { scrollTop: 0, scrollHeight: 0, clientTop: 0}; - const scrollTopMax = document.getElementById("chat-container").scrollHeight - document.getElementById("chat-container").clientTop; + const scrollTopMax = scrollHeight - clientTop; const isAtEdge = scrollTop > (0.92 * scrollTopMax) || scrollTop === 0; document.getElementById("messages").innerHTML = html; + if (!document.getElementById("chat-container")) return; const emplacedScrollTopMax = document.getElementById("chat-container").scrollHeight - document.getElementById("chat-container").clientTop; if (isAtEdge) { document.getElementById("chat-container").scrollTop = scrollTopMax; |