-
Notifications
You must be signed in to change notification settings - Fork 339
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
ESM build broken, causes scroll-to-top on iOS #271
Comments
I bumped into this issue as well. The cause is in function setPositionFixed():
ScrollX and scrollY are numbers, document.body.style.top expects CSS value with unit. This code practically tries to set invalid unitless value, which is OK in many browsers, but iOS Safari is strict and discards it. Adding unit fixes the issue.
Current source already has this change implemented, but the published ESM build is stuck to older version for some reason. |
A think the bug is partially fixed. This line is still missing the Found these alternatives, both seem to be a fork of the original |
They stopped the repairs. I had to do it myself, in the same way, with a new version of typeScript. And fix these problems for everyone to use. add react hooks、vue3 example
repair log,Refer to the releases page. |
So the reason this package still has problems on iOS (it does not move the
position: fixed
body upscrollY
pixels; it "scrolls to top" and stays there) is because the ESM build is broken. I haven't debugged what exactly is broken, but if I just grab the source from /src/bodyScrollLock.js and paste it into my project and import from there, the scroll to top problem on iOS is gone, it just works then.That's probably why Vercel forked and published it without major changes.
The text was updated successfully, but these errors were encountered: