From 786d72a950ad99bd4d64ddcc0d9614fed2b2863e Mon Sep 17 00:00:00 2001 From: Matei Stanca <i@ambientimpact.com> Date: Wed, 27 Nov 2024 00:55:53 -0500 Subject: [PATCH] Issue #3487907: Drupal.displace() check Drupal.elementIsHidden(): This is more thorough and actually determines if the element is visible or has dimensions. --- core/misc/displace.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/core/misc/displace.js b/core/misc/displace.js index 73084be85fc4..50534dff9a81 100644 --- a/core/misc/displace.js +++ b/core/misc/displace.js @@ -159,12 +159,9 @@ const n = displacingElements.length; for (let i = 0; i < n; i++) { const el = displacingElements[i]; - // If the element is set to display: none; do not consider its dimensions. - // - // @see https://api.jquery.com/hidden-selector/ - // For a more thorough implementation that considers other properties - // and whether the element has layout at all. - if (getComputedStyle(el).display === 'none') { + // If the element is hidden or not visible, do not consider its + // dimensions. + if (Drupal.elementIsHidden(el)) { continue; } // If the offset data attribute contains a displacing value, use it. -- GitLab