A platform for community discussion. Free, open, simple.
FIX: do not autofocus input on edit in mobile (#26554)
Joffrey JAFFEUX0bee802ccc85
diff --git a/plugins/chat/assets/javascripts/discourse/services/chat-channel-composer.js b/plugins/chat/assets/javascripts/discourse/services/chat-channel-composer.jsindex 89ff9389244..2f23ec2756a 100644--- a/plugins/chat/assets/javascripts/discourse/services/chat-channel-composer.js+++ b/plugins/chat/assets/javascripts/discourse/services/chat-channel-composer.js@@ -13,6 +13,7 @@ export default class ChatChannelComposer extends Service {@service loadingSlider;@service capabilities;@service appEvents;+ @service site;@tracked textarea;@tracked scrollable;@@ -48,7 +49,10 @@ export default class ChatChannelComposer extends Service {this.chat.activeMessage = null;message.editing = true;message.channel.draft = message;- this.focus({ refreshHeight: true, ensureAtEnd: true });++ if (this.site.desktopView) {+ this.focus({ refreshHeight: true, ensureAtEnd: true });+ }}@actiondiff --git a/plugins/chat/assets/javascripts/discourse/services/chat-thread-composer.js b/plugins/chat/assets/javascripts/discourse/services/chat-thread-composer.jsindex 7eff7352dea..c58b3ac4f17 100644--- a/plugins/chat/assets/javascripts/discourse/services/chat-thread-composer.js+++ b/plugins/chat/assets/javascripts/discourse/services/chat-thread-composer.js@@ -8,6 +8,7 @@ export default class ChatThreadComposer extends Service {@service chat;@service capabilities;@service appEvents;+ @service site;@tracked textarea;@tracked scrollable;@@ -43,7 +44,10 @@ export default class ChatThreadComposer extends Service {this.chat.activeMessage = null;message.editing = true;message.thread.draft = message;- this.focus({ refreshHeight: true, ensureAtEnd: true });++ if (this.site.desktopView) {+ this.focus({ refreshHeight: true, ensureAtEnd: true });+ }}@action