body-scroll-lock
body-scroll-lock copied to clipboard
Doesn't work in Safari iOS 11.3
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:
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
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.
@peterlyshak
Can you share a codepen or codesandbox snippet?
@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.
@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
@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.