diff --git a/src/client/utils/position.ts b/src/client/utils/position.ts index df0427d34..d9604785f 100644 --- a/src/client/utils/position.ts +++ b/src/client/utils/position.ts @@ -209,7 +209,7 @@ export function getElementRectangle (el) { rectangle = getSelectChildRectangle(el); else { const elementOffset = getOffsetPosition(el); - const relativeRectangle = domUtils.isSVGElementOrChild(el) ? getSvgElementRelativeRectangle(el) : el.getBoundingClientRect(); + const relativeRectangle = domUtils.isSVGElementOrChild(el) ? getSvgElementRelativeRectangle(el) : el.getClientRects()[0]; rectangle = { height: relativeRectangle.height, diff --git a/src/client/utils/style.ts b/src/client/utils/style.ts index 2f307350b..116cebfd7 100644 --- a/src/client/utils/style.ts +++ b/src/client/utils/style.ts @@ -319,7 +319,7 @@ export function getOffset (el) { if (!el || domUtils.isWindow(el) || domUtils.isDocument(el)) return null; - let clientRect = el.getBoundingClientRect(); + let clientRect = el.getClientRects()[0]; // NOTE: A detached node or documentElement. const doc = el.ownerDocument; @@ -338,7 +338,7 @@ export function getOffset (el) { const scrollTop = win.pageYOffset || docElement.scrollTop || doc.body.scrollTop; const scrollLeft = win.pageXOffset || docElement.scrollLeft || doc.body.scrollLeft; - clientRect = el.getBoundingClientRect(); + clientRect = el.getClientRects()[0]; return { top: clientRect.top + scrollTop - clientTop,