summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth@simponic.xyz>2025-01-13 23:03:44 -0800
committerElizabeth Hunt <elizabeth@simponic.xyz>2025-01-13 23:03:44 -0800
commitaf7206cd6c4e3cd02e4fe653d3d2c9e1e6bc95ca (patch)
tree85d369fadaca103babff637ff7bb2b30b72bb422
parentce0ce143ba74fdcc5d1cb4c6b09a41b2804cf0ab (diff)
downloadphoneof-af7206cd6c4e3cd02e4fe653d3d2c9e1e6bc95ca.tar.gz
phoneof-af7206cd6c4e3cd02e4fe653d3d2c9e1e6bc95ca.zip
fix for chrome
-rw-r--r--static/js/components/chat.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/static/js/components/chat.js b/static/js/components/chat.js
index e5d1185..2122064 100644
--- a/static/js/components/chat.js
+++ b/static/js/components/chat.js
@@ -6,14 +6,15 @@ const runChat = async () => {
r.text(),
);
- const { scrollTop, scrollTopMax } = document.getElementById(
+ const { scrollTop, scrollHeight, clientTop } = document.getElementById(
"chat-container",
- ) ?? { scrollTop: 0 };
+ ) ?? { scrollTop: 0, scrollHeight: 0, clientTop: 0};
+ const scrollTopMax = document.getElementById("chat-container").scrollHeight - document.getElementById("chat-container").clientTop;
const isAtEdge = scrollTop > (0.92 * scrollTopMax) || scrollTop === 0;
document.getElementById("messages").innerHTML = html;
+ const emplacedScrollTopMax = document.getElementById("chat-container").scrollHeight - document.getElementById("chat-container").clientTop;
if (isAtEdge) {
- document.getElementById("chat-container").scrollTop =
- document.getElementById("chat-container").scrollTopMax;
+ document.getElementById("chat-container").scrollTop = scrollTopMax;
} else {
// save the position.
document.getElementById("chat-container").scrollTop = scrollTop;