Skip to content
This repository was archived by the owner on Jun 6, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions packages/react-ui-core/src/ModalStack/ModalStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ export default class ModalStack extends PureComponent {
this.loadCurrentModal()
}

componentWillUnmount() {
this.toggleBodyClass(false)
this.modalHost = undefined
}

@autobind
onClose() {
const { currentModal, onClose } = this.props
Expand Down Expand Up @@ -109,10 +114,7 @@ export default class ModalStack extends PureComponent {

toggleBodyClass(toggle) {
const { theme } = this.props

if (this.modalHost) {
document.body.classList.toggle(theme['Overlay-lock'], toggle)
}
document.body.classList.toggle(theme['Overlay-lock'], toggle)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious if this works as expected in IE - according to toggle() docs IE does not support second argument: https://developer.mozilla.org/en-US/docs/Web/API/Element/classList

}

@autobind
Expand Down Expand Up @@ -145,7 +147,6 @@ export default class ModalStack extends PureComponent {
return createPortal(this.renderModals(), this.modalHost)
}

this.toggleBodyClass(false)
return null
}
}