diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-message-actions-desktop.hbs b/plugins/chat/assets/javascripts/discourse/components/chat-message-actions-desktop.hbs
index 9497e261da1..6fdde4039a0 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-message-actions-desktop.hbs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-message-actions-desktop.hbs
@@ -2,7 +2,6 @@
{
@@ -382,11 +388,13 @@ export default class ChatMessage extends Component {
return;
}
- this._onMouseEnterMessageDebouncedHandler = discourseDebounce(
- this,
- this._debouncedOnHoverMessage,
- 250
- );
+ if (!this.secondaryActionsIsExpanded) {
+ this._onMouseEnterMessageDebouncedHandler = discourseDebounce(
+ this,
+ this._debouncedOnHoverMessage,
+ 250
+ );
+ }
}
@action
@@ -399,7 +407,9 @@ export default class ChatMessage extends Component {
return;
}
- this._setActiveMessage();
+ if (!this.secondaryActionsIsExpanded) {
+ this._setActiveMessage();
+ }
}
@action
@@ -417,8 +427,9 @@ export default class ChatMessage extends Component {
) {
return;
}
-
- this.chat.activeMessage = null;
+ if (!this.secondaryActionsIsExpanded) {
+ this.chat.activeMessage = null;
+ }
}
@bind
diff --git a/plugins/chat/spec/system/chat_channel_spec.rb b/plugins/chat/spec/system/chat_channel_spec.rb
index 225f2050c5a..f45eb8338ee 100644
--- a/plugins/chat/spec/system/chat_channel_spec.rb
+++ b/plugins/chat/spec/system/chat_channel_spec.rb
@@ -287,4 +287,31 @@ RSpec.describe "Chat channel", type: :system do
)
end
end
+
+ context "when opening message secondary options" do
+ it "doesn’t hide dropdown on mouseleave" do
+ chat.visit_channel(channel_1)
+ last_message = find(".chat-message-container:last-child")
+ last_message.hover
+
+ expect(page).to have_css(
+ ".chat-message-actions-container[data-id='#{last_message["data-id"]}']",
+ )
+
+ find(".chat-message-actions-container .secondary-actions").click
+ expect(page).to have_css(
+ ".chat-message-actions-container .secondary-actions .select-kit-body",
+ )
+
+ find("#site-logo").hover
+ expect(page).to have_css(
+ ".chat-message-actions-container .secondary-actions .select-kit-body",
+ )
+
+ find("#site-logo").click
+ expect(page).to have_no_css(
+ ".chat-message-actions-container .secondary-actions .select-kit-body",
+ )
+ end
+ end
end