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

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

View File

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