feat: scroll down on new messages

This commit is contained in:
ktyl 2024-07-10 14:16:33 +01:00
parent bb8114de90
commit 37e2f1d3f2
1 changed files with 3 additions and 0 deletions

View File

@ -114,6 +114,9 @@ function addMessage(idx) {
let message = conversation[idx]; let message = conversation[idx];
let messageHtml = getMessageHtml(message.text, isMessageOurs(message)); let messageHtml = getMessageHtml(message.text, isMessageOurs(message));
getMessageList().innerHTML += messageHtml; getMessageList().innerHTML += messageHtml;
// scroll as far as we can so that messages aren't hidden
window.scrollTo(0, document.body.scrollHeight);
} }
function getMessageHtml(text, isOurs) { function getMessageHtml(text, isOurs) {