diff --git a/addons/website/static/src/js/content/snippets.animation.js b/addons/website/static/src/js/content/snippets.animation.js index e7b9fe37eed..a19e57b9f82 100644 --- a/addons/website/static/src/js/content/snippets.animation.js +++ b/addons/website/static/src/js/content/snippets.animation.js @@ -1142,7 +1142,16 @@ registry.FullScreenHeight = publicWidget.Widget.extend({ // Doing it that way allows to considerer fixed headers, hidden headers, // connected users, ... const firstContentEl = $('#wrapwrap > main > :first-child')[0]; // first child to consider the padding-top of main + // When a modal is open, we remove the "modal-open" class from the body. + // This is because this class sets "#wrapwrap" and "" to + // "overflow: hidden," preventing the "closestScrollable" function from + // correctly recognizing the scrollable element closest to the element + // for which the height needs to be calculated. Without this, the + // "mainTopPos" variable would be incorrect. + const modalOpen = document.body.classList.contains("modal-open"); + document.body.classList.remove("modal-open"); const mainTopPos = firstContentEl.getBoundingClientRect().top + $(firstContentEl.parentNode).closestScrollable()[0].scrollTop; + document.body.classList.toggle("modal-open", modalOpen); return (windowHeight - mainTopPos); }, });