body-scroll-lock
body-scroll-lock copied to clipboard
Enable body scroll not working sometimes
Sometimes, the function to enable scroll has no effect.
As you can see on your own demo page:
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
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 Looks like https://bodyscrolllock.now.sh
is deployed with an old version of the library. @willmcpo is this meant to update automatically?
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 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.
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.