@@ -51,7 +51,10 @@ var Modal = module.exports = React.createClass({
51
51
ariaAppHider . toggle ( props . isOpen , props . appElement ) ;
52
52
}
53
53
sanitizeProps ( props ) ;
54
- this . portal = React . renderComponent ( ModalPortal ( props ) , this . node ) ;
54
+ if ( this . portal )
55
+ this . portal . setProps ( props ) ;
56
+ else
57
+ this . portal = React . renderComponent ( ModalPortal ( props ) , this . node ) ;
55
58
} ,
56
59
57
60
render : function ( ) {
@@ -63,7 +66,6 @@ function sanitizeProps(props) {
63
66
delete props . ref ;
64
67
}
65
68
66
-
67
69
} , { "../helpers/ariaAppHider" :3 , "../helpers/injectCSS" :5 , "./ModalPortal" :2 } ] , 2 :[ function ( _dereq_ , module , exports ) {
68
70
var React = ( typeof window !== "undefined" ? window . React : typeof global !== "undefined" ? global . React : null ) ;
69
71
var div = React . DOM . div ;
@@ -137,8 +139,10 @@ var ModalPortal = module.exports = React.createClass({
137
139
} ,
138
140
139
141
maybeFocus : function ( ) {
140
- if ( this . props . isOpen )
142
+ if ( this . props . isOpen &&
143
+ ! this . refs . content . getDOMNode ( ) . contains ( document . activeElement ) ) {
141
144
this . focusContent ( ) ;
145
+ }
142
146
} ,
143
147
144
148
focusContent : function ( ) {
@@ -164,8 +168,8 @@ var ModalPortal = module.exports = React.createClass({
164
168
} ,
165
169
166
170
handleKeyDown : function ( event ) {
167
- if ( event . key == 9 /*tab*/ ) scopeTab ( this . getDOMNode ( ) , event ) ;
168
- if ( event . key == 27 /*esc*/ ) this . requestClose ( ) ;
171
+ if ( event . keyCode == 9 /*tab*/ ) scopeTab ( this . getDOMNode ( ) , event ) ;
172
+ if ( event . keyCode == 27 /*esc*/ ) this . requestClose ( ) ;
169
173
} ,
170
174
171
175
handleOverlayClick : function ( ) {
@@ -176,7 +180,7 @@ var ModalPortal = module.exports = React.createClass({
176
180
} ,
177
181
178
182
requestClose : function ( ) {
179
- if ( this . ownerHandlesClose )
183
+ if ( this . ownerHandlesClose ( ) )
180
184
this . props . onRequestClose ( ) ;
181
185
} ,
182
186
@@ -220,7 +224,6 @@ var ModalPortal = module.exports = React.createClass({
220
224
}
221
225
} ) ;
222
226
223
-
224
227
} , { "../helpers/focusManager" :4 , "../helpers/scopeTab" :6 } ] , 3 :[ function ( _dereq_ , module , exports ) {
225
228
var _element = null ;
226
229
0 commit comments