body-scroll-lock icon indicating copy to clipboard operation
body-scroll-lock copied to clipboard

Doesn't work in Safari iOS 11.3

Open PeterLyshak opened this issue 6 years ago • 6 comments

Hello, thanks for this plugin.

Scroll lock doesn't work in safari ios 11.3.

Link - https://peterlyshak.github.io/park-legend/dist/

Modal opens in the bottom: 2018-10-01 19 13 37

PeterLyshak avatar Oct 01 '18 16:10 PeterLyshak

Doesn't work for me either, simple demo here:

https://codepen.io/thismarcoantonio/pen/RerbvP

Also, I don't know why window.scrollTo doesnt work in ios too :/

thismarcoantonio avatar Oct 02 '18 19:10 thismarcoantonio

@thismarcoantonio

I'm not sure if the demo is the use case this library supports.

Typically, you supply an element to the disableBodyScroll function that you want to keep scrolling. What this will do also is lock the body scroll.

In your demo, I noticed you passed the document body in to the function. I've not tested this usage... but to interpret what this usage is saying is, you want to make the body scrollable while locking the body ...

Can you try not passing any argument into the functions and see if that works? Sorry don't have iPhone with me at the moment so can't test myself.

willmcpo avatar Oct 02 '18 22:10 willmcpo

@peterlyshak

Can you share a codepen or codesandbox snippet?

willmcpo avatar Oct 02 '18 22:10 willmcpo

@willmcpo when I pass document.body to the function, it prevents body from scrolling in desktop and android (Tested on chrome). When I try to disable scrolling in ios with the same demo, it does not work.

About passing the element down, document.body will return body element, same as document.querySelector('body').

I'll test this demo without arguments soon, then I'll post feedback here.

thismarcoantonio avatar Oct 03 '18 03:10 thismarcoantonio

@willmcpo I can give you access to my github repository, because it's a big html landing page.

Added, https://github.com/PeterLyshak/park-legend

PeterLyshak avatar Oct 03 '18 06:10 PeterLyshak

@willmcpo I can confirm this bug. Scrolling is not disabled in iOS. Here's a sandbox - https://codesandbox.io/s/949o90nj64

I was able to disable scrolling with this SO post.

borisyordanov avatar Dec 03 '18 16:12 borisyordanov