Skip to content

Commit

Permalink
[fixed] Dont change body class if isOpen not change (reactjs#201)
Browse files Browse the repository at this point in the history
  • Loading branch information
khmelevskii authored and claydiffrient committed Aug 10, 2016
1 parent d347547 commit 1e29e4f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/components/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,16 @@ var Modal = React.createClass({
},

renderPortal: function(props) {
if (props.isOpen) {
elementClass(document.body).add('ReactModal__Body--open');
} else {
elementClass(document.body).remove('ReactModal__Body--open');
}
if (this.props.isOpen !== props.isOpen) {
if (props.isOpen) {
elementClass(document.body).add('ReactModal__Body--open');
} else {
elementClass(document.body).remove('ReactModal__Body--open');
}

if (props.ariaHideApp) {
ariaAppHider.toggle(props.isOpen, props.appElement);
if (props.ariaHideApp) {
ariaAppHider.toggle(props.isOpen, props.appElement);
}
}

this.portal = renderSubtreeIntoContainer(this, ModalPortal(Assign({}, props, {defaultStyles: Modal.defaultStyles})), this.node);
Expand Down

0 comments on commit 1e29e4f

Please sign in to comment.