diff --git a/src/components/Overlay.tsx b/src/components/Overlay.tsx index c8a555365..940a68401 100644 --- a/src/components/Overlay.tsx +++ b/src/components/Overlay.tsx @@ -13,7 +13,7 @@ import {findDOMNode} from 'react-dom'; import React from 'react'; import {calculatePosition, getContainer, ownerDocument} from '../utils/dom'; import {autobind} from '../utils/helper'; -import {resizeSensor} from '../utils/resize-sensor'; +import {resizeSensor, getComputedStyle} from '../utils/resize-sensor'; // @ts-ignore BasePosition.propTypes.placement = () => null; @@ -38,7 +38,10 @@ class Position extends BasePosition { }); } - if (!this.watchedTarget || this.watchedTarget !== target) { + if ( + (!this.watchedTarget || this.watchedTarget !== target) && + getComputedStyle(target, 'position') !== 'static' + ) { this.resizeDispose?.(); this.watchedTarget = target; this.resizeDispose = resizeSensor(target, () => diff --git a/src/utils/resize-sensor.ts b/src/utils/resize-sensor.ts index 68b172a05..8f2f9677a 100644 --- a/src/utils/resize-sensor.ts +++ b/src/utils/resize-sensor.ts @@ -17,7 +17,7 @@ class EventQueue { } } -function getComputedStyle(element: HTMLElement, prop: string) { +export function getComputedStyle(element: HTMLElement, prop: string) { if ((element as any).currentStyle) { return (element as any).currentStyle[prop]; } else if (window.getComputedStyle) {