FIX: correctly nullifies active message (#21739)
Very fast or specific mouse moves could allow to leave a message actions menu without reseting the active message. This commit should ensure we correctly catch this event. No test as it's hard and not reliable to reproduce these in a test.
This commit is contained in:
parent
a048aeef6a
commit
082921c4c8
|
@ -2,6 +2,7 @@
|
||||||
<div
|
<div
|
||||||
{{did-insert this.setup}}
|
{{did-insert this.setup}}
|
||||||
{{did-update this.setup this.chat.activeMessage.model.id}}
|
{{did-update this.setup this.chat.activeMessage.model.id}}
|
||||||
|
{{on "mouseleave" this.onMouseleave}}
|
||||||
{{will-destroy this.teardown}}
|
{{will-destroy this.teardown}}
|
||||||
class={{concat-class
|
class={{concat-class
|
||||||
"chat-message-actions-container"
|
"chat-message-actions-container"
|
||||||
|
|
|
@ -44,6 +44,21 @@ export default class ChatMessageActionsDesktop extends Component {
|
||||||
return this.size === FULL;
|
return this.size === FULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@action
|
||||||
|
onMouseleave(event) {
|
||||||
|
// if the mouse is leaving the actions menu for the actual menu, don't close it
|
||||||
|
// this will avoid the menu rerendering
|
||||||
|
if (
|
||||||
|
(event.toElement || event.relatedTarget)?.closest(
|
||||||
|
".chat-message-container"
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.chat.activeMessage = null;
|
||||||
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
setup(element) {
|
setup(element) {
|
||||||
this.popper?.destroy();
|
this.popper?.destroy();
|
||||||
|
|
Loading…
Reference in New Issue