From f19ed887d209c687b04ac26486a100158bf4374b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=C3=89vrard?= Date: Fri, 2 Oct 2026 16:07:28 +0200 Subject: [PATCH] Do not go further than the modal window when computing the scrollable ancestors Closes #15143 --- sao/src/common.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sao/src/common.js b/sao/src/common.js index e7f5b2b87f..10b31715f4 100644 --- a/sao/src/common.js +++ b/sao/src/common.js @@ -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; }