Skip to content

Commit 2b4d66e

Browse files
use cross-browser compatible API for viewport overflow calculation (#93)
1 parent 863ee42 commit 2b4d66e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/TooltipTrigger.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ class TooltipTrigger extends Component<
105105
const { pageX, pageY } = this.state;
106106
const { width, height } = this.popperOffset;
107107
const x =
108-
pageX! + width > window.scrollX + document.body.offsetWidth
108+
pageX! + width > window.pageXOffset + document.body.offsetWidth
109109
? pageX! - width
110110
: pageX;
111111
const y =
112-
pageY! + height > window.scrollY + document.body.offsetHeight
112+
pageY! + height > window.pageYOffset + document.body.offsetHeight
113113
? pageY! - height
114114
: pageY;
115115
style.transform = `translate3d(${x}px, ${y}px, 0`;

0 commit comments

Comments
 (0)