Do not go further than the modal window when computing the scrollable ancestors

Closes #15143
This commit is contained in:
Nicolas Évrard
2026-10-02 16:07:28 +02:00
parent c24235f075
commit f19ed887d2
+5 -2
View File
@@ -89,13 +89,16 @@
function getScrollableAncestors(el) {
let ancestors = [];
let parent = el.parentElement;
while (parent && parent !== document.body) {
while (parent && (parent !== document.body ||
!parent.classList.contains('modal'))) {
if (isScrollable(parent)) {
ancestors.push(parent);
}
parent = parent.parentElement;
}
ancestors.push(window);
if (!parent.classList.contains('modal')) {
ancestors.push(window);
}
return ancestors;
}