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

Enable body scroll not working sometimes

Open Artotim opened this issue 4 years ago • 5 comments

Sometimes, the function to enable scroll has no effect.

As you can see on your own demo page:

image

There is no scroll bar and I cannot scroll anywhere with the mouse wheel. It comes back if I click disable and enable again. But on my web page the user doesn't have this option.

I'm on Chrome 84.0.4147.105

Artotim avatar Aug 13 '20 04:08 Artotim

I did a quick research and this seems to happen if you click "Disable" twice, and then try to enable it. This happens because disableBodyScroll() does not check whether given element is already disabled, and effectively doubles the amount of locks on that given element:

https://github.com/willmcpo/body-scroll-lock/blob/e6ea1b77b79abb92e00f8afe115e19f0dd33f514/src/bodyScrollLock.js#L186

adamwych avatar Aug 13 '20 11:08 adamwych

@adamwych Looks like https://bodyscrolllock.now.sh is deployed with an old version of the library. @willmcpo is this meant to update automatically?

diachedelic avatar Aug 18 '20 00:08 diachedelic

hey unfortunately there's no CICD setup to automatically update the demos. Apologies I'm a bit short of time. I've manually updated the demo and their links for now.

If someone could set up the Github Actions to get that up and running, that'd be cool =)

willmcpo avatar Aug 28 '20 13:08 willmcpo

@willmcpo I would be inclined to use a postpublish hook rather than CI for this, that way the demo will always be running the latest version of the package.

diachedelic avatar Aug 29 '20 00:08 diachedelic

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. add react hooks、vue3 example

npm i body-scroll-lock-upgrade

repair log,Refer to the releases page.

rick-liruixin avatar May 06 '23 03:05 rick-liruixin