mirror of
https://git.bsd.gay/fef/nyastodon.git
synced 2024-12-24 03:43:42 +01:00
Fix #298 - Esc to close modal
This commit is contained in:
parent
3114e55c7a
commit
d9232959df
1 changed files with 12 additions and 0 deletions
|
@ -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…
Reference in a new issue