Skip to content

Commit

Permalink
[fixed] Removes body classNames after the modal is closed.
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardoNogueira authored and diasbruno committed Oct 18, 2017
1 parent 1fb33d9 commit 5ec0f7f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/ModalPortal.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ export default class ModalPortal extends Component {
}

componentWillUnmount() {
// Remove body class
bodyClassList.remove(this.props.bodyOpenClassName);
this.beforeClose();
clearTimeout(this.closeTimer);
}
Expand Down Expand Up @@ -125,16 +127,16 @@ 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);
}
}

afterClose = () => {
// Remove body class
bodyClassList.remove(this.props.bodyOpenClassName);
focusManager.returnFocus();
focusManager.teardownScopedFocus();
};
Expand Down

0 comments on commit 5ec0f7f

Please sign in to comment.