From ffd222e8833f3b38ee2ba89695bf5e6362f4abcf Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Mon, 23 Jan 2023 15:59:12 +0100 Subject: [PATCH] FIX: prevents msg-actions to show hover text (#19952) This case was possible in restrained space when the top of the message was not visible in the viewport. --- .../chat-message-actions-desktop.js | 23 ++++--------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-message-actions-desktop.js b/plugins/chat/assets/javascripts/discourse/components/chat-message-actions-desktop.js index e6ad42af9eb..6ceb7ae07d0 100644 --- a/plugins/chat/assets/javascripts/discourse/components/chat-message-actions-desktop.js +++ b/plugins/chat/assets/javascripts/discourse/components/chat-message-actions-desktop.js @@ -4,8 +4,7 @@ import { createPopper } from "@popperjs/core"; import { schedule } from "@ember/runloop"; import { inject as service } from "@ember/service"; -const MSG_ACTIONS_HORIZONTAL_PADDING = 2; -const MSG_ACTIONS_VERTICAL_PADDING = -28; +const MSG_ACTIONS_VERTICAL_PADDING = -10; export default Component.extend({ tagName: "", @@ -28,27 +27,13 @@ export default Component.extend({ `.chat-message-actions-container[data-id="${this.message.id}"] .chat-message-actions` ), { - placement: "right-start", + placement: "top-end", modifiers: [ { name: "hide", enabled: true }, - { - name: "eventListeners", - options: { - scroll: false, - }, - }, + { name: "eventListeners", options: { scroll: false } }, { name: "offset", - options: { - offset: ({ popper, placement }) => { - return [ - MSG_ACTIONS_VERTICAL_PADDING, - -(placement.includes("left") || placement.includes("right") - ? popper.width + MSG_ACTIONS_HORIZONTAL_PADDING - : popper.height), - ]; - }, - }, + options: { offset: [0, MSG_ACTIONS_VERTICAL_PADDING] }, }, ], }