From 5ec0f7fec652de504e7d49635991ddaefd6c788d Mon Sep 17 00:00:00 2001 From: Eduardo Nogueira <1110512@isep.ipp.pt> Date: Mon, 16 Oct 2017 22:35:04 +0100 Subject: [PATCH] [fixed] Removes body classNames after the modal is closed. --- src/components/ModalPortal.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/ModalPortal.js b/src/components/ModalPortal.js index eb2cd4e4..0a4354f6 100644 --- a/src/components/ModalPortal.js +++ b/src/components/ModalPortal.js @@ -98,6 +98,8 @@ export default class ModalPortal extends Component { } componentWillUnmount() { + // Remove body class + bodyClassList.remove(this.props.bodyOpenClassName); this.beforeClose(); clearTimeout(this.closeTimer); } @@ -125,9 +127,7 @@ export default class ModalPortal extends Component { } beforeClose() { - const { appElement, ariaHideApp, bodyOpenClassName } = this.props; - // Remove class if no more modals are open - bodyClassList.remove(bodyOpenClassName); + const { appElement, ariaHideApp } = this.props; // Reset aria-hidden attribute if all modals have been removed if (ariaHideApp && refCount.totalCount() < 1) { ariaAppHider.show(appElement); @@ -135,6 +135,8 @@ export default class ModalPortal extends Component { } afterClose = () => { + // Remove body class + bodyClassList.remove(this.props.bodyOpenClassName); focusManager.returnFocus(); focusManager.teardownScopedFocus(); };