FIX: closes chat emoji picker on body scroll (#23362)
Prior to this fix we would scroll the emoji picker with the body of the page in drawer mode. With this fix scrolling inside the drawer or the emoji picker will scroll the drawer or the emoji picker, but, scrolling body will close the chat emoji picker.
This commit is contained in:
parent
5cb45f8714
commit
ed35ae4dcd
|
@ -3,13 +3,39 @@ import { action } from "@ember/object";
|
|||
import { inject as service } from "@ember/service";
|
||||
import { headerOffset } from "discourse/lib/offset-calculator";
|
||||
import { createPopper } from "@popperjs/core";
|
||||
import ChatEmojiPicker from "discourse/plugins/chat/discourse/components/chat-emoji-picker";
|
||||
import { modifier } from "ember-modifier";
|
||||
|
||||
export default class ChatChannelMessageEmojiPicker extends Component {
|
||||
<template>
|
||||
{{! template-lint-disable modifier-name-case }}
|
||||
<ChatEmojiPicker
|
||||
@context="chat-channel-message"
|
||||
@didInsert={{this.didInsert}}
|
||||
@willDestroy={{this.willDestroy}}
|
||||
@didSelectEmoji={{this.didSelectEmoji}}
|
||||
@class="hidden"
|
||||
{{this.listenToBodyScroll}}
|
||||
/>
|
||||
</template>
|
||||
|
||||
@service site;
|
||||
@service chatEmojiPickerManager;
|
||||
|
||||
context = "chat-channel-message";
|
||||
|
||||
listenToBodyScroll = modifier(() => {
|
||||
const handler = () => {
|
||||
this.chatEmojiPickerManager.close();
|
||||
};
|
||||
|
||||
document.addEventListener("scroll", handler);
|
||||
|
||||
return () => {
|
||||
document.removeEventListener("scroll", handler);
|
||||
};
|
||||
});
|
||||
|
||||
@action
|
||||
didSelectEmoji(emoji) {
|
||||
this.chatEmojiPickerManager.picker?.didSelectEmoji(emoji);
|
|
@ -1,7 +0,0 @@
|
|||
<ChatEmojiPicker
|
||||
@context="chat-channel-message"
|
||||
@didInsert={{this.didInsert}}
|
||||
@willDestroy={{this.willDestroy}}
|
||||
@didSelectEmoji={{this.didSelectEmoji}}
|
||||
@class="hidden"
|
||||
/>
|
|
@ -15,6 +15,7 @@
|
|||
{{will-destroy (if @willDestroy @willDestroy (noop))}}
|
||||
{{will-destroy this.removeClickOutsideEventListener}}
|
||||
{{on "keydown" this.trapKeyDownEvents}}
|
||||
...attributes
|
||||
>
|
||||
<div class="chat-emoji-picker__filter-container">
|
||||
<DcFilterInput
|
||||
|
|
Loading…
Reference in New Issue