Skip to content

Commit b7a38de

Browse files
committed
[fixed] Warning caused by trying to focus null element
closes #11
1 parent 2ac5290 commit b7a38de

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

Diff for: lib/components/ModalPortal.js

+5-9
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ var ModalPortal = module.exports = React.createClass({
3636
// Focus needs to be set when mounting and already open
3737
if (this.props.isOpen) {
3838
this.setFocusAfterRender(true);
39+
this.open();
3940
}
40-
this.handleProps(this.props);
4141
},
4242

4343
componentWillReceiveProps: function(newProps) {
@@ -46,7 +46,10 @@ var ModalPortal = module.exports = React.createClass({
4646
this.setFocusAfterRender(true);
4747
}
4848

49-
this.handleProps(newProps);
49+
if (newProps.isOpen === true)
50+
this.open();
51+
else if (newProps.isOpen === false)
52+
this.close();
5053
},
5154

5255
componentDidUpdate: function () {
@@ -60,13 +63,6 @@ var ModalPortal = module.exports = React.createClass({
6063
this.focusAfterRender = focus;
6164
},
6265

63-
handleProps: function(props) {
64-
if (props.isOpen === true)
65-
this.open();
66-
else if (props.isOpen === false)
67-
this.close();
68-
},
69-
7066
open: function() {
7167
focusManager.setupScopedFocus(this.getDOMNode());
7268
focusManager.markForFocusLater();

0 commit comments

Comments
 (0)