fix
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Elizabeth Hunt 2025-01-16 17:19:01 -08:00
parent af7206cd6c
commit b2391b058b

View File

@ -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;