@@ -51,7 +51,10 @@ var Modal = module.exports = React.createClass({
5151 ariaAppHider . toggle ( props . isOpen , props . appElement ) ;
5252 }
5353 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 ) ;
5558 } ,
5659
5760 render : function ( ) {
@@ -63,7 +66,6 @@ function sanitizeProps(props) {
6366 delete props . ref ;
6467}
6568
66-
6769} , { "../helpers/ariaAppHider" :3 , "../helpers/injectCSS" :5 , "./ModalPortal" :2 } ] , 2 :[ function ( _dereq_ , module , exports ) {
6870var React = ( typeof window !== "undefined" ? window . React : typeof global !== "undefined" ? global . React : null ) ;
6971var div = React . DOM . div ;
@@ -137,8 +139,10 @@ var ModalPortal = module.exports = React.createClass({
137139 } ,
138140
139141 maybeFocus : function ( ) {
140- if ( this . props . isOpen )
142+ if ( this . props . isOpen &&
143+ ! this . refs . content . getDOMNode ( ) . contains ( document . activeElement ) ) {
141144 this . focusContent ( ) ;
145+ }
142146 } ,
143147
144148 focusContent : function ( ) {
@@ -164,8 +168,8 @@ var ModalPortal = module.exports = React.createClass({
164168 } ,
165169
166170 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 ( ) ;
169173 } ,
170174
171175 handleOverlayClick : function ( ) {
@@ -176,7 +180,7 @@ var ModalPortal = module.exports = React.createClass({
176180 } ,
177181
178182 requestClose : function ( ) {
179- if ( this . ownerHandlesClose )
183+ if ( this . ownerHandlesClose ( ) )
180184 this . props . onRequestClose ( ) ;
181185 } ,
182186
@@ -220,7 +224,6 @@ var ModalPortal = module.exports = React.createClass({
220224 }
221225} ) ;
222226
223-
224227} , { "../helpers/focusManager" :4 , "../helpers/scopeTab" :6 } ] , 3 :[ function ( _dereq_ , module , exports ) {
225228var _element = null ;
226229
0 commit comments