willmcpo / body-scroll-lock

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

Wrong scrollBarGap if a transition runs while activating scroll lock #188

Closed martinkutter closed 4 years ago

martinkutter commented 4 years ago

If a transition started immediately after enableScrollLock is triggered, the size of the scrollBarGap could be wrong depending of the browser performance.

martinkutter commented 4 years ago

The issue is due to the asynchronous reading of the window size in the setOverflowHidden method. This is async because of an earlier performance fix for Desktop Safari. It is only necessary to set the overflow async, but it can be readed synchronous.