File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ import {
1414const propTypes = {
1515 isOpen : PropTypes . bool ,
1616 size : PropTypes . string ,
17- toggle : PropTypes . func . isRequired ,
17+ toggle : PropTypes . func ,
1818 keyboard : PropTypes . bool ,
1919 backdrop : PropTypes . oneOfType ( [
2020 PropTypes . bool ,
@@ -90,7 +90,7 @@ class Modal extends React.Component {
9090 }
9191
9292 handleEscape ( e ) {
93- if ( this . props . keyboard && e . keyCode === 27 ) {
93+ if ( this . props . keyboard && e . keyCode === 27 && this . props . toggle ) {
9494 this . props . toggle ( ) ;
9595 }
9696 }
@@ -100,7 +100,7 @@ class Modal extends React.Component {
100100
101101 const container = this . _dialog ;
102102
103- if ( e . target && ! container . contains ( e . target ) ) {
103+ if ( e . target && ! container . contains ( e . target ) && this . props . toggle ) {
104104 this . props . toggle ( ) ;
105105 }
106106 }
You can’t perform that action at this time.
0 commit comments