[FIX] website: fix animations in popups without backdrop

Since the scrollbar was moved from the window to .modal-content at [1],
animations inside popups without backdrops would not be working anymore
because the scroll was not checked against the right element.

This commit fixes this by using the right scroll element's scrollTop.

task-3328419

[1] https://github.com/odoo/odoo/commit/cb7cf77

closes odoo/odoo#135404

X-original-commit: 1b618b323424e29b0ddf9eae686e0ef2540b3627
Signed-off-by: Outagant Mehdi (mou) <mou@odoo.com>
This commit is contained in:
Robin Lejeune (role)
2023-09-15 20:34:29 +00:00
parent a9f9316b22
commit e3b3bc2978
2 changed files with 11 additions and 6 deletions
@@ -1465,11 +1465,15 @@ registry.WebsiteAnimate = publicWidget.Widget.extend({
// We need to offset for the change in position from some animation.
// So we get the top value by not taking CSS transforms into calculations.
// Cookies bar might be opened and considered as a modal but it is
// not really one (eg 'discrete' layout), and should not be used as
// scrollTop value.
const $closestModal = $el.closest(".modal:visible");
const scrollTop = $closestModal[0] ?
$closestModal.scrollTop() : this.$scrollingElement.scrollTop();
// not really one when there is no backdrop (eg 'discrete' layout),
// and should not be used as scrollTop value.
const closestModal = $el.closest(".modal:visible")[0];
let scrollTop = this.$scrollingElement[0].scrollTop;
if (closestModal) {
scrollTop = closestModal.classList.contains("s_popup_no_backdrop") ?
closestModal.querySelector(".modal-content").scrollTop :
closestModal.scrollTop;
}
const elTop = this._getElementOffsetTop(el) - scrollTop;
let visible;
const footerEl = el.closest('.o_footer_slideout');
@@ -64,7 +64,8 @@
.modal-content {
max-height:100%;
overflow: auto;
overflow-y: auto;
overflow-x: hidden;
}
}
}