willmcpo / body-scroll-lock

Body scroll locking that just works with everything 😏
MIT License
4.04k stars 337 forks source link

add touchmove event listener to document.body #104

Closed phelma closed 1 year ago

phelma commented 5 years ago

fixes body-scroll-lock for ios safari

phelma commented 5 years ago

What's going on on line 55/56? Surely thats not right?

No it isnt, i've updated

natterstefan commented 5 years ago

Hi @diachedelic, any chance this gets released soon? Looks like we experience similar issues on iOS currently.

diachedelic commented 5 years ago

@natterstefan @phelma hey all, can someone explain exactly why this patch is needed? Which versions of iOS safari require it? It certainly worked on previous versions.

axyz commented 5 years ago

any news on the topic? the library stopped working for us as well on IOS (both chrome and safari) and it was working some time ago even though the demo page seems to work correctly even today, maybe is a problem that presents itself on non trivial use cases with a slightly more complex DOM structure. I guess the demo page could have a modal implemented using a react portal (most likely one of the most common use cases) to check if it works correctly.

axyz commented 5 years ago

update: for what is worth I've forked the lib in my code and the changes in this PR seems indeed to fix the problem on IOS

diachedelic commented 5 years ago

@axyz thanks for the testing. Do you know what triggered locking to suddenly stopped working? What changed - did you upgrade body-scroll-lock, or your version of iOS? The lib seems to work fine for me on the iOS 12.2 simulator, with my fairly complex use case. Are you able to downgrade iOS and see if locking works again?

I'm sorry but I feel we need more clarity on this. The issues #102 and #103 referenced above seem unrelated.

axyz commented 5 years ago

@diachedelic at the beginning I think it was my fault: I was using the @zeix scoped version, maybe a warning on the README can be useful as the npm repo link point on the same place.

But then after upgrading to real latest version it fixed the problem of a full screen modal, but I was still able to scroll down (but not up, weirdly) in case of non fullscreen content.

I'm sorry I cannot give more detailed information, but we just noticed this now as with a full screen modal was much less noticeable to have the underlying content to scroll

willmcpo commented 5 years ago

Can someone provide a demo page with a Modal that's not working in IOS?

If that can be done, then I can help test/verify that this fix is good.

It'd be nice to get to the bottom of this.

willmcpo commented 5 years ago

And also, does the solution posted in https://github.com/willmcpo/body-scroll-lock/issues/102 help? If so, is this PR's fix still needed?

alxhghs commented 5 years ago

102 doesn't solve this for me

willmcpo commented 5 years ago

for those where it's not working, some code snippets to support the need for this PR would be helpful.

Otherwise, the mentioned problems will be assumed to be non-issues.

felipeplets commented 3 years ago

@willmcpo I've tested the changes in this PR and they also fix the issue I was having on iOS in which the scroll was not locking on Safari mobile.