Skip to content
Snippets Groups Projects
Commit d9232959 authored by Eugen Rochko's avatar Eugen Rochko
Browse files

Fix #298 - Esc to close modal

parent 3114e55c
No related branches found
No related tags found
No related merge requests found
......@@ -40,6 +40,18 @@ const Lightbox = React.createClass({
mixins: [PureRenderMixin],
componentDidMount () {
this._listener = window.addEventListener('keyup', e => {
if (e.key === 'Escape') {
this.props.onCloseClicked();
}
});
},
componentWillUnmount () {
window.removeEventListener(this._listener);
},
render () {
const { intl, isVisible, onOverlayClicked, onCloseClicked, children } = this.props;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment