Skip to content
Snippets Groups Projects
Commit 1b618b32 authored by Robin Lejeune (role)'s avatar Robin Lejeune (role)
Browse files

[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#122622

Signed-off-by: default avatarOutagant Mehdi (mou) <mou@odoo.com>
parent 3528f2c3
No related branches found
No related tags found
No related merge requests found
......@@ -1451,11 +1451,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;
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment