File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -29,14 +29,16 @@ var Modal = module.exports = React.createClass({
29
29
appElement : React . PropTypes . instanceOf ( SafeHTMLElement ) ,
30
30
onRequestClose : React . PropTypes . func ,
31
31
closeTimeoutMS : React . PropTypes . number ,
32
- ariaHideApp : React . PropTypes . bool
32
+ ariaHideApp : React . PropTypes . bool ,
33
+ shouldCloseOnOverlayClick : React . PropTypes . bool
33
34
} ,
34
35
35
36
getDefaultProps : function ( ) {
36
37
return {
37
38
isOpen : false ,
38
39
ariaHideApp : true ,
39
- closeTimeoutMS : 0
40
+ closeTimeoutMS : 0 ,
41
+ shouldCloseOnOverlayClick : true
40
42
} ;
41
43
} ,
42
44
Original file line number Diff line number Diff line change @@ -146,10 +146,12 @@ var ModalPortal = module.exports = React.createClass({
146
146
} ,
147
147
148
148
handleOverlayClick : function ( ) {
149
- if ( this . ownerHandlesClose ( ) )
150
- this . requestClose ( ) ;
151
- else
152
- this . focusContent ( ) ;
149
+ if ( this . props . shouldCloseOnOverlayClick ) {
150
+ if ( this . ownerHandlesClose ( ) )
151
+ this . requestClose ( ) ;
152
+ else
153
+ this . focusContent ( ) ;
154
+ }
153
155
} ,
154
156
155
157
requestClose : function ( ) {
You can’t perform that action at this time.
0 commit comments