Skip to content

Commit c2424eb

Browse files
committed
fix: DOMRect value issues
1 parent c629b9c commit c2424eb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/hooks/useAlign.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,15 @@ export default function useAlign(
213213
} else {
214214
const rect = target.getBoundingClientRect();
215215
targetRect = {
216-
x: rect.x,
217-
y: rect.y,
216+
x: rect.x || rect.left,
217+
y: rect.y || rect.top,
218218
width: rect.width,
219219
height: rect.height,
220220
};
221221
}
222222
const popupRect = popupElement.getBoundingClientRect();
223+
popupRect.x = popupRect.x || popupRect.left;
224+
popupRect.y = popupRect.y || popupRect.top;
223225
const {
224226
clientWidth,
225227
clientHeight,

0 commit comments

Comments
 (0)