1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-29 01:50:06 +02:00

corrects overscroll issue inside scrollable containers (#1032) (#1383)

* corrects overscroll issue inside scrollable containers; another fix for #1032

* fix(#1032) - set scrollers offset if within scrollable container
This commit is contained in:
Robert Dale Smith
2017-11-13 13:49:26 -06:00
committed by Ian Storm Taylor
parent 038de22b43
commit b973580c54

View File

@@ -71,10 +71,11 @@ function scrollToSelection(selection) {
xOffset = pageXOffset
} else {
const { offsetWidth, offsetHeight, scrollTop, scrollLeft } = scroller
const scrollerRect = scroller.getBoundingClientRect()
width = offsetWidth
height = offsetHeight
yOffset = scrollTop
xOffset = scrollLeft
yOffset = scrollTop - scrollerRect.top
xOffset = scrollLeft - scrollerRect.left
}
const top = (backward ? rect.top : rect.bottom) + yOffset