Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: closes chat emoji picker on body scroll #23362

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -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);
Expand Down

This file was deleted.

Expand Up @@ -15,6 +15,7 @@
{{will-destroy (if @willDestroy @willDestroy (noop))}}
{{will-destroy this.removeClickOutsideEventListener}}
{{on "keydown" this.trapKeyDownEvents}}
...attributes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this left over debugging code or some sort of magic I never learned about?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made a topic about this

>
<div class="chat-emoji-picker__filter-container">
<DcFilterInput
Expand Down