willmcpo / body-scroll-lock

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

clearAllBodyScrollLocks stops working on 3.1.3 #196

Closed elrumordelaluz closed 3 years ago

elrumordelaluz commented 3 years ago

Hi! For some reason updating from 3.0.3 into 3.1.3 seems that clearAllBodyScrollLocks stops working as expected. I am using in an useEffect callback, something like:

useEffect(() => {
    if (value) disableBodyScroll(ref.current)
    return () => {
      clearAllBodyScrollLocks()
    }
  }, [value])

Rolling back into 3.0.3 everything works well.

diachedelic commented 3 years ago

Hi, can you tell us what device/browser you are using when you experience this?

elrumordelaluz commented 3 years ago

Same behaviour in both Chrome Version 85.0.4183.83 (Official Build) (64-bit) and Firefox 80.0.1 (64-bit).

fernandoabolafio commented 3 years ago

Same here: Chrome Version 84.0.4147.135 (Official Build) (64-bit)

diachedelic commented 3 years ago

Possibly fixed in #199

jaimemnds commented 3 years ago

It looks like both clearAllBodyScrollLocks and enableBodyScroll stopped working in my case. I've rolled back to 3.0.3 and also got both of them working again. My usage is pretty much the same as @elrumordelaluz's.

MylesKingsnorth commented 3 years ago

I also can confirm clearAllBodyScrollLocks and enableBodyScroll doesn't work in a useEffect on 3.1.3 but does on 3.0.3

diachedelic commented 3 years ago

Could somebody please try applying the patch in #199 and see if that fixes it?

MylesKingsnorth commented 3 years ago

Could somebody please try applying the patch in #199 and see if that fixes it?

Seems to work for me

willmcpo commented 3 years ago

Published 3.1.5 with #199 - hopefully fixes it

ivan-kasabov commented 3 years ago

Published 3.1.5 with #199 - hopefully fixes it

Fixed it for me, thanks!