From 1e29e4f3bd482bf3320969abbda6c586801bd283 Mon Sep 17 00:00:00 2001 From: Yurii Khmelvskii Date: Wed, 10 Aug 2016 08:20:50 +0300 Subject: [PATCH] [fixed] Dont change body class if isOpen not change (#201) --- lib/components/Modal.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/components/Modal.js b/lib/components/Modal.js index 0fb48f26..f4b79950 100644 --- a/lib/components/Modal.js +++ b/lib/components/Modal.js @@ -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);