FIX: closing the picker shouldn't propagate the pointer event ()

This commit is contained in:
Joffrey JAFFEUX 2022-03-23 16:42:53 +01:00 committed by GitHub
parent cbaf7c949b
commit 4a39850aac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -153,9 +153,10 @@ export default Component.extend({
}, },
@action @action
onClose() { onClose(event) {
event?.stopPropagation();
document.removeEventListener("click", this.handleOutsideClick); document.removeEventListener("click", this.handleOutsideClick);
this.onEmojiPickerClose && this.onEmojiPickerClose(); this.onEmojiPickerClose && this.onEmojiPickerClose(event);
}, },
diversityScales: computed("selectedDiversity", function () { diversityScales: computed("selectedDiversity", function () {
@ -221,7 +222,7 @@ export default Component.extend({
}); });
if (this.site.isMobileDevice) { if (this.site.isMobileDevice) {
this.onClose(); this.onClose(event);
} }
}, },
@ -236,7 +237,7 @@ export default Component.extend({
@action @action
keydown(event) { keydown(event) {
if (event.code === "Escape") { if (event.code === "Escape") {
this.onClose(); this.onClose(event);
return false; return false;
} }
}, },
@ -334,7 +335,7 @@ export default Component.extend({
handleOutsideClick(event) { handleOutsideClick(event) {
const emojiPicker = document.querySelector(".emoji-picker"); const emojiPicker = document.querySelector(".emoji-picker");
if (emojiPicker && !emojiPicker.contains(event.target)) { if (emojiPicker && !emojiPicker.contains(event.target)) {
this.onClose(); this.onClose(event);
} }
}, },
}); });