Fix #298 - Esc to close modal

th-downstream
Eugen Rochko 8 years ago
parent 23a4f93345
commit 29bd2ba85b

@ -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;

Loading…
Cancel
Save