Skip to content

A platform for community discussion. Free, open, simple.

FIX: ensures composer is focused after edit (#18999)

Joffrey JAFFEUX27c15bfd5360
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-live-pane.js b/plugins/chat/assets/javascripts/discourse/components/chat-live-pane.js
index c23974fa4ed..54fd768d2d5 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-live-pane.js
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-live-pane.js
@@ -246,7 +246,7 @@ export default Component.extend({
this.highlightOrFetchMessage(this.targetMessageId);
}
- this.focusComposer();
+ this._focusComposer();
})
.catch(this._handleErrors)
.finally(() => {
@@ -1165,6 +1165,7 @@ export default Component.extend({
}
if (lastUserMessage) {
this.set("editingMessage", lastUserMessage);
+ this._focusComposer();
}
},
@@ -1395,21 +1396,6 @@ export default Component.extend({
return this._fetchAndScrollToLatest();
},
- focusComposer() {
- if (
- this._selfDeleted ||
- this.site.mobileView ||
- this.chatChannel?.isDraft
- ) {
- return;
- }
-
- schedule("afterRender", () => {
- document.querySelector(".chat-composer-input")?.focus();
- });
- },
-
- @afterRender
_focusComposer() {
this.appEvents.trigger("chat:focus-composer");
},