New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Block scrolling events behind the modal #60
Comments
The modal adds a class to the body element: |
@zdfs , thanks that worked for me |
@nateajohnson see solution provided by @zdfs above. |
Hi, This solution doesn't work when you use classes by some reason. |
I suggest a configuration be added to control this, in order to hide implementation details. I did spend some time figuring out a solution for this. |
@zdfs what if we need to keep the scroll working and only have the body not scroll up when the modal opens? I am dynamically adding a class to the body that sets overflow-y to hidden at the same time as the 'ReactModal__Body--open' class gets added and it is still scrolling up. |
Is there some way to block scrolling events behind the modal while the modal is active? I have a long list of items and each one opens a modal. If you scroll while the modal is active, even if there isn't data to scroll in the modal, it scrolls the list behind the modal. This can be replicated by just adding a bunch of paragraph tags to the example project so that you page is large. What's worse is when there is data in the modal that also scrolls. The scrolling will scroll behind the modal all the way to the top or bottom and then start scrolling the data inside the modal.
Anyone know how to fix this behavior?
Thanks!
The text was updated successfully, but these errors were encountered: