diff --git a/addons/website/static/src/js/content/snippets.animation.js b/addons/website/static/src/js/content/snippets.animation.js index 16bd00593b0..c4f645365d4 100644 --- a/addons/website/static/src/js/content/snippets.animation.js +++ b/addons/website/static/src/js/content/snippets.animation.js @@ -1194,6 +1194,20 @@ registry.BottomFixedElement = publicWidget.Widget.extend({ return; } + // The bottom fixed elements are always hidden when a modal is open + // thanks to the CSS that is based on the 'modal-open' class added to + // the body. However, when the modal does not have a backdrop (e.g. + // cookies bar), this 'modal-open' class is not added. That's why we + // handle it here. Note that the popup widget code triggers a 'scroll' + // event when the modal is hidden to make the bottom fixed elements + // reappear. + if (this.el.querySelector('.s_popup_no_backdrop.show')) { + for (const el of $bottomFixedElements) { + el.classList.add('o_bottom_fixed_element_hidden'); + } + return; + } + this._restoreBottomFixedElements($bottomFixedElements); if ((this.$scrollingElement[0].offsetHeight + this.$scrollingElement[0].scrollTop) >= (this.$scrollingElement[0].scrollHeight - 2)) { const buttonEls = [...this.$('a:visible, .btn:visible')]; diff --git a/addons/website/static/src/snippets/s_popup/000.js b/addons/website/static/src/snippets/s_popup/000.js index 196276066e2..7c2ebca1c42 100644 --- a/addons/website/static/src/snippets/s_popup/000.js +++ b/addons/website/static/src/snippets/s_popup/000.js @@ -52,6 +52,14 @@ const SharedPopupWidget = publicWidget.Widget.extend({ * @private */ _onModalHidden() { + if (this.el.querySelector('.s_popup_no_backdrop')) { + // We trigger a scroll event here to call the + // '_hideBottomFixedElements' method and re-display any bottom fixed + // elements that may have been hidden (e.g. the live chat button + // hidden when the cookies bar is open). + $().getScrollingElement()[0].dispatchEvent(new Event('scroll')); + } + this.el.classList.add('d-none'); }, });