Merge pull request #923 from Bilb/fix-close-sessionmodal

fix catch of mouse events on forgotten modals
pull/933/head
Audric Ackermann 5 years ago committed by GitHub
commit 6b2afdf047
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -26,12 +26,10 @@
registerEvents() {
this.unregisterEvents();
document.addEventListener('mousedown', this.props.onClickClose, false);
document.addEventListener('keyup', this.props.onClickClose, false);
},
unregisterEvents() {
document.removeEventListener('mousedown', this.props.onClickClose, false);
document.removeEventListener('keyup', this.props.onClickClose, false);
},

@ -21,7 +21,7 @@ export class ConfirmDialog extends React.Component<Props> {
return (
<SessionModal
title={this.props.titleText}
onClose={() => null}
onClose={this.props.onClose}
onOk={() => null}
>
<div className="spacer-md" />

@ -95,7 +95,7 @@ export class CreateGroupDialog extends React.Component<Props, State> {
);
return (
<SessionModal title={titleText} onClose={() => null} onOk={() => null}>
<SessionModal title={titleText} onClose={this.closeDialog} onOk={() => null}>
<div className="spacer-lg" />
<p className={errorMessageClasses}>{this.state.errorMessage}</p>

@ -53,7 +53,7 @@ export class SessionConfirm extends React.Component<Props> {
return (
<SessionModal
title={title}
onClose={() => null}
onClose={onClickClose}
onOk={() => null}
showExitIcon={false}
showHeader={showHeader}

@ -51,7 +51,7 @@ export class SessionModal extends React.PureComponent<Props, State> {
window.addEventListener('keyup', this.onKeyUp);
}
public componentWillMount() {
public componentDidMount() {
document.addEventListener('mousedown', this.handleClick, false);
}
@ -127,6 +127,7 @@ export class SessionModal extends React.PureComponent<Props, State> {
});
window.removeEventListener('keyup', this.onKeyUp);
document.removeEventListener('mousedown', this.handleClick, false);
if (this.props.onClose) {
this.props.onClose();

Loading…
Cancel
Save