Skip to content
Snippets Groups Projects
Commit d95a21cc authored by netpro2k's avatar netpro2k
Browse files

Close modals on escape. Fixes #313

parent 2f8fc17b
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
height: 100%; height: 100%;
top: 0; top: 0;
left: 0; left: 0;
position: absolute; position: fixed;
pointer-events: none; pointer-events: none;
color: white; color: white;
z-index: 2; z-index: 2;
......
...@@ -27,6 +27,21 @@ class InfoDialog extends Component { ...@@ -27,6 +27,21 @@ class InfoDialog extends Component {
const loc = document.location; const loc = document.location;
this.shareLink = `${loc.protocol}//${loc.host}${loc.pathname}`; this.shareLink = `${loc.protocol}//${loc.host}${loc.pathname}`;
this.onKeyPress = this.onKeyPress.bind(this);
}
componentDidMount() {
window.addEventListener("keypress", this.onKeyPress);
}
componentWillUnmount() {
window.removeEventListener("keypress", this.onKeyPress);
}
onKeyPress(e) {
if (e.key === "Escape") {
this.props.onCloseDialog();
}
} }
shareLinkClicked = () => { shareLinkClicked = () => {
......
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