diff --git a/src/plugins/sib-reactions.js b/src/plugins/sib-reactions.js index eb9c9a42a78a4301f9c9101563dbf287e3e5fea7..80d73ce1607ac7af7478691ccaacbeea3b83b8cb 100644 --- a/src/plugins/sib-reactions.js +++ b/src/plugins/sib-reactions.js @@ -243,6 +243,15 @@ converse.plugins.add('sib-reactions', { picker.remove(); } }); + + // Close the picker if clicked outside of it + setTimeout(() => { + document.addEventListener('click', ev => { + if (!picker.shadowRoot.contains(ev.composedPath()[0])) { + picker.remove(); + } + }); + }); }, /** @@ -330,6 +339,15 @@ converse.plugins.add('sib-reactions', { picker.remove(); } }); + + // Close the picker if clicked outside of it + setTimeout(() => { + document.addEventListener('click', ev => { + if (!picker.shadowRoot.contains(ev.composedPath()[0])) { + picker.remove(); + } + }); + }); }, 'button_class': 'chat-msg__action-react', 'icon_class': 'fa fa-smile',