Skip to content

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

UX: prevents long press on reaction to open actions (#20899)

Joffrey JAFFEUX6ba24b3599f3
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-message-reaction.hbs b/plugins/chat/assets/javascripts/discourse/components/chat-message-reaction.hbs
index 52f3f07b6f9..5c16e184fcb 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-message-reaction.hbs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-message-reaction.hbs
@@ -1,6 +1,7 @@
{{#if (and @reaction this.emojiUrl)}}
<button
type="button"
+ {{on "touchstart" this.handleTouchStart}}
{{on "click" this.handleClick}}
tabindex="0"
class={{concat-class
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-message-reaction.js b/plugins/chat/assets/javascripts/discourse/components/chat-message-reaction.js
index 3f7fda312e6..0ab877d5fe6 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-message-reaction.js
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-message-reaction.js
@@ -45,6 +45,11 @@ export default class ChatMessageReaction extends Component {
return emojiUrlFor(this.args.reaction.emoji);
}
+ @action
+ handleTouchStart(event) {
+ event.stopPropagation();
+ }
+
@action
handleClick() {
this.args.react?.(