willmcpo / body-scroll-lock

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

Enable body scroll not working sometimes #192

Open Artotim opened 4 years ago

Artotim commented 4 years ago

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

adamwych commented 4 years ago

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

diachedelic commented 4 years ago

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

willmcpo commented 3 years ago

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 =)

diachedelic commented 3 years ago

@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.

rick-liruixin commented 1 year ago

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.