Closed nicksmider closed 2 years ago
βοΈ Deploy Preview for evergreen-storybook ready!
π¨ Explore the source changes: c8e59e2644555464c108e9e1fcc5d6968744e444
π Inspect the deploy log: https://app.netlify.com/sites/evergreen-storybook/deploys/61cca5343811e500078af6fb
π Browse the preview: https://deploy-preview-1383--evergreen-storybook.netlify.app
Hmm, makes sense to me. Is there an easy way to demo this change in Storybook or the docs or would it be easier to demo in the app?
Additionally, while I know there's no existing unit tests for this utility, it would be awesome to whip up a few at least to cover the new behavior π Food for thought - non-blocking, as this seems like a pretty jarring bug as-is
Demoing in the app would definitely be easiest. I can whip up some tests π
Overview
When another package/script OR multiple complements use prevent-body-scroll together previousOverflow and previousPaddingRight get stuck.
Scenario observed:
document.body.style.overflow = 'hidden'
preventBodyScrolling
set overtop the fullscreen.previousOverflow
is set tohidden
document.body.style.overflow = previousOverflow
keeps it at hidden. Now only the fullscreen overlay(not evergreen) is updocument.body.style.overflow = ''
document.body.style.overflow
is not set, however, the next Evergreen overlay that does not usepreventBodyScrolling
will default to using the oldpreviousOverflow
which was never cleared, disabling all scrolling on the overlay, when it was not intended toThe proposed change will create a history of the overlay changes, and once restored, remove it from the history. This will allow multiple overlays to have
preventBodyScrolling
up at a time without having to figure out if another is already up, and it will allow it to play nicely with outside scripts that are also dealing with settingdocument.body.style.overflow
Screenshots (if applicable)
Documentation (n/a to this change)