diff --git a/src/plugins/sib-reactions.js b/src/plugins/sib-reactions.js index e20ae3b4f00f02fc3a1b17423a5a19ff0633a141..a2c2092d23e61ed6de0e4f10d0e9a7a3621dbf42 100644 --- a/src/plugins/sib-reactions.js +++ b/src/plugins/sib-reactions.js @@ -266,6 +266,17 @@ converse.plugins.add('sib-reactions', { let rectTop = tr.top + window.pageYOffset - docEl.clientTop; let rectLeft = tr.left + window.pageXOffset - docEl.clientLeft; + // Fix the position if contained in a shadowRoot + // TODO: Should iterate through all the parent instances + const root = _converse.root; + if (root.nodeType === 11) { + const rcr = root.getRootNode().host?.getBoundingClientRect(); + if (rcr) { + rectLeft -= rcr.left; + rectTop -= rcr.top; + } + } + picker.style.position = 'fixed'; picker.style.zIndex = '999'; picker.style.margin = '10px'; @@ -313,6 +324,8 @@ converse.plugins.add('sib-reactions', { }, }; + window._converse = _converse; + // Apply message mixin const Message = _converse.api.elements.registry['converse-chat-message']; const _renderMessageText = Message.prototype.renderMessageText;