Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get position with default scroll values #67

Open
bastienrobert opened this issue Dec 9, 2021 · 0 comments
Open

Get position with default scroll values #67

bastienrobert opened this issue Dec 9, 2021 · 0 comments

Comments

@bastienrobert
Copy link

bastienrobert commented Dec 9, 2021

I use useMeasure on a simple div element. When I refresh the page, the scroll stays at the same position after the refresh as before, both on Safari, Chrome and Firefox.
My element's position values change because it doesn't calculate the window scroll values to add the Y overflow to the top/Y and the X overflow to the left/X.
I know this is the way getBoundingClientRect works but it could be very useful to get the right position values.

I've made a small repro here and a video:
https://user-images.githubusercontent.com/14930937/145437063-1438c794-d2af-4a02-a21a-7e241c7f37d7.mov

The scroll option fix this problem but it re-render the component each time I scroll, which is not fully efficient.
Maybe it could be a good solution to pass an option for this specific behavior?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant