-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[BUG] useScroll() with container option behave strangely #1853
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
I set container for useScroll() AND if there is some element before container. useScroll() would be affected and looks like it is working.
Codesandbox and how to reproduce
The reproduction is a tweaked version from track-element-position.
The tweaks:
- I add a container in
#58948Awith fix height andoverflowY: "auto"to make it scrollable. - To get
Itemthe container, I use react Context (ContainerRefContext) - A
divin#21434Ejust to simulate the scenario
Please comment/un-comment the #21434E div to see how different useScroll() behaves.
With no other element before the container, the progress is filled. But if there are elements taking space before container, the progress would not able to be filled.
It's easier to explain it by video.
e9f5baf9-8ac6-488f-bb17-b3a72aa023bb.mp4
04f3179f-9337-4797-a801-f255d251baf1.mp4
Expected behavior
useScroll() should not be affected by what other elements placed on the docuemnt.
Environment details
Windows 10 21H2
chrome 108.0.5359.125
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working