File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,15 @@ var LightboxModal = React.createClass({
45
45
padding : '11px 3px' ,
46
46
textDecoration : 'none'
47
47
} ,
48
+
49
+ componentDidMount : function ( ) {
50
+ document . addEventListener ( "keydown" , function ( e ) {
51
+ if ( ( this . props . display ) && ( e . keyCode === 27 ) ) {
52
+ this . props . closeLightbox ( ) ;
53
+ }
54
+ } . bind ( this ) ) ;
55
+ } ,
56
+
48
57
render : function ( ) {
49
58
50
59
for ( j in this . props ) {
@@ -56,7 +65,7 @@ var LightboxModal = React.createClass({
56
65
if ( this . props . display ) {
57
66
return (
58
67
< div >
59
- < div style = { this . blackOverlayStyles } />
68
+ < div style = { this . blackOverlayStyles } onClick = { this . props . closeLightbox } />
60
69
< div style = { this . whiteContentStyles } >
61
70
< a style = { this . closeTagStyles } onClick = { this . props . closeLightbox } > ×</ a >
62
71
{ this . props . children }
You can’t perform that action at this time.
0 commit comments