diff --git a/lib/components/ModalPortal.js b/lib/components/ModalPortal.js index 854e0692..4c15c902 100644 --- a/lib/components/ModalPortal.js +++ b/lib/components/ModalPortal.js @@ -36,8 +36,8 @@ var ModalPortal = module.exports = React.createClass({ // Focus needs to be set when mounting and already open if (this.props.isOpen) { this.setFocusAfterRender(true); + this.open(); } - this.handleProps(this.props); }, componentWillReceiveProps: function(newProps) { @@ -46,7 +46,10 @@ var ModalPortal = module.exports = React.createClass({ this.setFocusAfterRender(true); } - this.handleProps(newProps); + if (newProps.isOpen === true) + this.open(); + else if (newProps.isOpen === false) + this.close(); }, componentDidUpdate: function () { @@ -60,13 +63,6 @@ var ModalPortal = module.exports = React.createClass({ this.focusAfterRender = focus; }, - handleProps: function(props) { - if (props.isOpen === true) - this.open(); - else if (props.isOpen === false) - this.close(); - }, - open: function() { focusManager.setupScopedFocus(this.getDOMNode()); focusManager.markForFocusLater();