WindowScroller setting incorrect scrollTop after resizing window height
See original GitHub issueI updated the version of WindowScroller for one of my projects today from 8.8.1
to the current version (8.11.0
) and noticed this bug. More details about the use cases and the specifics of the bug below.
To reproduce
To reproduce the bug:
- Set up
WindowScroller
without specifying the newscrollElement
prop (i.e. you want it to usewindow
). My use case uses aGrid
insideWindowScroller
, but I think a similar issue would occur with other components. - Scroll the page.
scrollTop
is set as expected at this point and everything works well. - Scroll the page down far enough that the top of the container (i.e. element for your
Grid
or other component inside theWindowScroller
) is off the top of the viewport. - Resize the height of your browser window.
- Scroll the page.
scrollTop
is incorrectly set and theGrid
behaves weirdly because it has the wrong scroll value.
I took a quick look at the project’s WindowScroller
demo and see similar “weird” behavior when I follow these steps, so hopefully that will be an easy example to work from.
Suspected cause
After looking at the changelog and some of the related source code, I suspect this bug came in with the support for a custom target element in v8.10.0. I’m guessing the problem lies in getPositionFromTop and how it is handling the calculations for the window
use case.
Additional details:
I rolled back to my previous version (8.8.1
) and verified this bug does not exist there.
Browser: Chrome 55 on OSX 10.11
Use case in my code: Grid
inside a WindowScroller
that only uses WindowScroller for vertical scrolling per the documentation that says it should not be used for horizontal scrolling.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top GitHub Comments
Yeah, I’m already on it. Will have a PR shortly.
Fix released in version 8.11.1. Thanks for the detailed bug report @juliepagano! And thanks for the quick fix @andrewbranch! ❤️