react-modal-bootstrap icon indicating copy to clipboard operation
react-modal-bootstrap copied to clipboard

Browser scroll disappear when a sub modal is open.

Open mharocsc opened this issue 8 years ago • 1 comments

I have a modal dialog that have enough information to get scroll in browser, but once I open a sub modal, the scroll disappears (which I'm OK with, no problem with that)

The problem is, once I close that sub modal, my scroll does not come back. What I noticed is that the children-open class is not being removed from the backdrop in my root modal dialog, when I close the sub modal, not only is not being removed, a children-open class is added each time I open a sub modal (if I open 10 time the sub modal, 10 times the children-open class is added to the root modal tag.

Any ideas what I'm doing wrong? Or why you guys think this is happening? Tks.

modal dialog sub modal open sub modal closed

mharocsc avatar Aug 24 '17 22:08 mharocsc

thank you for your analyzing

due to this repository seem to be inactive, i wrote a comment instead of PR

typescript

import * as React from 'react'
import {Modal as ModalComponent} from 'react-modal-bootstrap'

class Modal<P, S> extends React.Component<P, S> {
  componentWillUnmount() {
    if (window) {
      window.document.getElementsByTagName('body')[0].classList.remove('modal-open')
    }
  }
}

javascript

import React from 'react'
import {Modal as ModalComponent} from 'react-modal-bootstrap'

class Modal extends React.Component {
  componentWillUnmount() {
    if (window) {
      window.document.getElementsByTagName('body')[0].classList.remove('modal-open')
    }
  }
}

deptno avatar Sep 14 '17 16:09 deptno