willmcpo / body-scroll-lock

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

Doesn't work on iOS #177

Closed sairus2k closed 3 years ago

sairus2k commented 4 years ago

The video was recorded on simulator iPhone 8 iOS 13.4 The same behavior is on device iPhone 5s iOS 12.4

ezgif-3-e00cc8f4b1d4

knynkwl commented 4 years ago

+1 getting this issue as well.

hacknug commented 4 years ago

Works fine for me on iOS 13.5 (17F5065a)

ryanirilli commented 4 years ago

See these lines in the src, you must provide a target element for this to work in iOS Safari. After I added a target it works for me.

https://github.com/willmcpo/body-scroll-lock/blob/master/src/bodyScrollLock.js#L147-L149

eni9889 commented 4 years ago

I have a target element and it is still not working on the ios 13.5 simulator. I am not able to scroll any elements on the page including the target element. It works on desktop

virginie-p commented 4 years ago

Doesn't work on iOs either (Safari), the body doesn't have an inline style added (overflow: hidden;) but on Chrome (desktop) this inline style is here.

diachedelic commented 4 years ago

I have tested body-scroll-lock@3.0.3 in the iOS simulator running 13.5, with and without fixed elements, and it appears to work fine. Are you sure it is an issue introduced by iOS 13.5? Can you test with 13.4.1 @eni9889 ? Please supply a minimal reproduction if possible.

overflow: hidden is not added on iOS @virginie-p , instead the strategy is to block touchmove events.

metinsut commented 4 years ago

Same problem: bsl-3.0.3, IOS-13.5 bodyScrollLock.esm.js

inside enableBodyScroll function;

line 210,211 targetElement.ontouchstart = null; targetElement.ontouchmove = null;

Error -> Attempted to assign to readonly property.

diachedelic commented 4 years ago

@metinsut are you sure you are passing a DOM element to enableScrollLock? See https://github.com/willmcpo/body-scroll-lock/issues/110

metinsut commented 4 years ago

@metinsut are you sure you are passing a DOM element to enableScrollLock? See #110

Uhh sorry my bad 🤦, I am so sorry for being careless.

diachedelic commented 4 years ago

It's OK, there should be a better error message.

shurinskiy commented 3 years ago

Yes, this does not work on ipad ios 12.4.8

diachedelic commented 3 years ago

@shurinskiy bodyscrollock.now.sh uses a very out of date version of the library

shurinskiy commented 3 years ago

@shurinskiy bodyscrollock.now.sh uses a very out of date version of the library

@diachedelic Too bad, it was a very handy thing. Can you advise what I can use instead?

pomacs-store commented 3 years ago

@shurinskiy the demos have recently been updated with latest library version and the readme has been updated with new Demo links.

diachedelic commented 3 years ago

@shurinskiy this has just been fixed in #194