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) {