From a55d15b635363229c86a9791dddd5cb12436a1d0 Mon Sep 17 00:00:00 2001 From: retoor Date: Fri, 23 May 2025 03:01:20 +0200 Subject: [PATCH] The force. --- src/snek/static/chat-input.js | 9 ++++++++- src/snek/static/message-list.js | 10 +++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/snek/static/chat-input.js b/src/snek/static/chat-input.js index 4fcf0eb..4dfcac4 100644 --- a/src/snek/static/chat-input.js +++ b/src/snek/static/chat-input.js @@ -47,8 +47,12 @@ class ChatInputComponent extends HTMLElement { this.textarea.focus(); } + async connectedCallback() { - this.user = await app.rpc.getUser(null); + this.user = null + app.rpc.getUser(null).then((user) => { + this.user=user + }) this.liveType = this.getAttribute("live-type") === "true"; this.liveTypeInterval = parseInt(this.getAttribute("live-type-interval")) || 3; @@ -152,6 +156,9 @@ class ChatInputComponent extends HTMLElement { }); app.rpc.sendMessage(this.channelUid, message); }); + setTimeout(()=>{ + this.focus(); + },1000) } trackSecondsBetweenEvents(event1Time, event2Time) { diff --git a/src/snek/static/message-list.js b/src/snek/static/message-list.js index e4e7702..720cb6c 100644 --- a/src/snek/static/message-list.js +++ b/src/snek/static/message-list.js @@ -19,10 +19,14 @@ class MessageList extends HTMLElement { this.items = []; } scrollToBottom(force) { - + console.info("Scrolling down") // if (force) { - this.scrollTop = this.scrollHeight; - //this.querySelector(".message-list-bottom").scrollIntoView(); + //this.scrollTop = this.scrollHeight; + + this.querySelector(".message-list-bottom").scrollIntoView(); + setTimeout(() => { + this.querySelector(".message-list-bottom").scrollIntoView(); + },200) // } } updateMessageText(uid, message) {