React-modal: Prevent background scrolling when modal is displayed

Created on 12 Oct 2016  路  4Comments  路  Source: reactjs/react-modal

I couldn't find the proper solution to prevent scrolling of the backdrop when modal is displayed. I found a few but it was confusing and long text too. How is it done?

question

Most helpful comment

I'm having this issue on IOS, even with the overflow: hidden it scrolls. Any ideas?

All 4 comments

This css code worked very well for me.

.ReactModal__Body--open {
  overflow: hidden;
}

I'm having this issue on IOS, even with the overflow: hidden it scrolls. Any ideas?

This doesn't seem to be working at all?

Safari ignores overflow on body, allowing you to touch-scroll it.

https://medium.com/react-camp/how-to-fight-the-body-scroll-2b00267b37ac

I am implementing my own modal but, came across this while searching for solutions, may help others!

Was this page helpful?
0 / 5 - 0 ratings