-
Notifications
You must be signed in to change notification settings - Fork 541
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Current Behavior
Whenever the user closes the connect modal the page is scrolled to the top.
Expected Behavior
The page should stay at the same scroll-y position.
Steps To Reproduce
- Install package on a nextJS project
- Create a connect button lower the the view-height
- Click on the button.
What package is effected by this issue?
@web3-onboard/core
Is this a build or a runtime issue?
Runtime
Package Version
2.9.0-alpha.1
Node Version
16
What browsers are you seeing the problem on?
Chrome
Relevant log output
No response
Anything else?
The problem seems to be linked to this part of the onDestroy handler :
const scrollY = body.style.top;
body.style.top = '';
window.scrollTo(0, parseInt(scrollY || '0') * -1);
window.removeEventListener('scroll', trackYScrollPosition);Replacing the scrollYdeclaration with
const scrollY = html.style.getPropertyValue('--scroll-y');would most likely fix the issue
For some reason, the body.style.top setter is very inconsistent and works only a few times leaving the scrollY value to 0.
Sanity Check
- If this is a build issue, I have included my build config. If this is a runtime issue, I have included reproduction steps and/or a Minimal, Reproducible Example.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working