Open alexanderKhvostov opened 3 years ago
Hi, @alexanderKhvostov you have a look at this pull requests and see if it works for you: https://github.com/willmcpo/body-scroll-lock/pull/207
I experience the same issue at least on iOS 12 😕
The PR #207 is not helpful, settings overflow: hidden
is not a solution.
Hi @horaklukas,
Can you please elaborate how did you test PR #207 ? Did you inspect the dom to make sure overflow: hidden
was actually applied to the body element?
Hi @jvitela
In some cases, the scroll has arrived at the bottom of the scroll element area. If there is a scroll in the content area, the scroll of the content moves.
<body>
// scroll content
<div>
</div>
// scroll popup element
<div>
</div>
</body>
@jvitela unfortunately this doesn't help. Since OP haven't provided much details I'd like to elaborate on when this bug might be seen. There're two conditions required for this bug to happen:
If these two conditions are met and user starts scrolling, it will happen.
If finger is being put on any other place of the screen or when the toolbar is shown, everything works as expected. I believe this bug is caused by some Safari internals and nothing can be done for now.
@JonesTwink
hi,did you solve it?
Hi @chendong-xie and @JonesTwink,
Yes, my last change fixes this issue. Setting position:fixed
forces the browser to display the toolbar and therefore there is no scrollable area.
Please do test the latest changes of the feature branch and confirm if it also works for you. The examples are updated so you don't need to rebuild it yourself.
hi @jvitela this way looks ok, thank you for your reply. when you plan to release this feature?
hi @chendong-xie,
when you plan to release this feature?
That question should be answered by @willmcpo
Hi @chendong-xie and @JonesTwink,
Yes, my last change fixes this issue. Setting
position:fixed
forces the browser to display the toolbar and therefore there is no scrollable area.Please do test the latest changes of the feature branch and confirm if it also works for you. The examples are updated so you don't need to rebuild it yourself.
if you solving it with position: fixed
you gotta be aware of scroll reset, i e for example you clicking a button that opens modal and that button is at middle of document (i e scrollTop > 0). Than when you lock the scroll with forcing safari to show bottom bar (by setting position:fixed
) your scroll is gonna reset (scrollTop === 0)
@n19htz Do you mean this? https://github.com/jvitela/body-scroll-lock/blob/3b7877b77c997751ff484a5f89ca2eeb5fda1bed/src/bodyScrollLock.js#L120
yes, i've tried 4.0.0-beta version and scroll restoration does not work there
@n19htz Could you please provide a minimal reproducible example? or in case it happens with the included examples a video showing the issue would be great and please indicate the browser and OS versions.
I have a quetion, will this fix also fix the problem with jumping layout when clicking on inputs inside modals? I know that position: fixed casues the bug it happens only on scrollable elements. To fix my case i had to completely hide the page contents and display only a modal. Feels like it could be part of this bug.
Example video:
https://user-images.githubusercontent.com/7709957/127474305-2afbe204-73c1-4589-b370-6b4c0516c3a3.mov
const { scrollY, scrollX, innerHeight } = window;
document.body.style.position = 'fixed';
document.body.style.top = -scrollY; //Mabye there and next line should be add + "px" in the end.
document.body.style.left = -scrollX;
Hi @Trendymen and @pawelbujna,
Please check https://github.com/willmcpo/body-scroll-lock/pull/229
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.
npm i body-scroll-lock-upgrade
repair Changelog Refer to the releases page.
Hi, sorry but it doesn't work :( I still can sometime scroll body. Maybe Apple again has changed something?
Iphone 11pro IOs 13.6. https://www.loom.com/share/9fe89fe098e64e64a26d5533f9921f29