mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-09-02 03:32:36 +02:00
Use pageXOffset instead of scrollX (#1631)
`scrollX`/`scrollY` do not work on some browsers, using `pageXOffset`/`pageYOffset` instead: https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollX#Notes
This commit is contained in:
committed by
Ian Storm Taylor
parent
a43c3fbb61
commit
8ab88871bc
@@ -126,9 +126,9 @@ class HoveringMenu extends React.Component {
|
||||
const range = selection.getRangeAt(0)
|
||||
const rect = range.getBoundingClientRect()
|
||||
menu.style.opacity = 1
|
||||
menu.style.top = `${rect.top + window.scrollY - menu.offsetHeight}px`
|
||||
menu.style.top = `${rect.top + window.pageYOffset - menu.offsetHeight}px`
|
||||
menu.style.left = `${rect.left +
|
||||
window.scrollX -
|
||||
window.pageXOffset -
|
||||
menu.offsetWidth / 2 +
|
||||
rect.width / 2}px`
|
||||
}
|
||||
|
Reference in New Issue
Block a user