Skip to content

Commit

Permalink
fix(modal): only call toggleClass when needed (#7082)
Browse files Browse the repository at this point in the history
Co-authored-by: Alessandra Davila <aledavila@ibm.com>
  • Loading branch information
tw15egan and Alessandra Davila authored Oct 19, 2020
1 parent 5bba369 commit b162614
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/react/src/components/ComposedModal/ComposedModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,14 @@ export default class ComposedModal extends Component {
} else if (prevState.open && !this.state.open) {
this.beingOpen = false;
}
toggleClass(
document.body,
`${prefix}--body--with-modal-open`,
this.state.open
);

if (prevState.open !== this.state.open) {
toggleClass(
document.body,
`${prefix}--body--with-modal-open`,
this.state.open
);
}
}

focusButton = (focusContainerElement) => {
Expand Down

0 comments on commit b162614

Please sign in to comment.