diff --git a/src/modules/Modal/Modal.js b/src/modules/Modal/Modal.js index 5d85bc9810..1fc75b3134 100644 --- a/src/modules/Modal/Modal.js +++ b/src/modules/Modal/Modal.js @@ -178,7 +178,7 @@ class Modal extends Component { const { onClose } = this.props if (onClose) onClose(e, this.props) - this.trySetState({ open: false }) + this.trySetState({ open: false }, { scrolling: false }) } handleIconOverrides = predefinedProps => ({ diff --git a/test/specs/modules/Modal/Modal-test.js b/test/specs/modules/Modal/Modal-test.js index 2dac549550..3fcc2e983a 100644 --- a/test/specs/modules/Modal/Modal-test.js +++ b/test/specs/modules/Modal/Modal-test.js @@ -503,6 +503,26 @@ describe('Modal', () => { }) }) + it('adds the scrolling class to the body after re-open', (done) => { + assertBodyClasses('scrolling', false) + + window.innerHeight = 10 + wrapperMount(foo) + + requestAnimationFrame(() => { + assertBodyClasses('scrolling') + domEvent.click('.ui.dimmer') + + assertBodyClasses('scrolling', false) + + wrapper.setProps({ open: true }) + requestAnimationFrame(() => { + assertBodyClasses('scrolling') + done() + }) + }) + }) + it('removes the scrolling class from the body on unmount', (done) => { assertBodyClasses('scrolling', false)