From 3a76250a228d1a37bb9a8e56e7738954777dc2dd Mon Sep 17 00:00:00 2001 From: Khaled Sakr Date: Thu, 27 Aug 2020 11:35:38 +0200 Subject: [PATCH] fix(getposition): properly determine parents with will-change: transform Parent elements with property will-change: transform change the containing block, we have to account for that when calculating the tooltip position. Reference: https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_Block --- src/utils/getPosition.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/utils/getPosition.js b/src/utils/getPosition.js index 0d85584b8..cdd776301 100755 --- a/src/utils/getPosition.js +++ b/src/utils/getPosition.js @@ -240,9 +240,12 @@ const calculateOffset = offset => { const getParent = currentTarget => { let currentParent = currentTarget; while (currentParent) { + const computedStyle = window.getComputedStyle(currentParent); + // transform and will-change: transform change the containing block + // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_Block if ( - window.getComputedStyle(currentParent).getPropertyValue('transform') !== - 'none' + computedStyle.getPropertyValue('transform') !== 'none' || + computedStyle.getPropertyValue('will-change') === 'transform' ) break; currentParent = currentParent.parentElement;