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() { registerEvents() {
this.unregisterEvents(); this.unregisterEvents();
document.addEventListener('mousedown', this.props.onClickClose, false);
document.addEventListener('keyup', this.props.onClickClose, false); document.addEventListener('keyup', this.props.onClickClose, false);
}, },
unregisterEvents() { unregisterEvents() {
document.removeEventListener('mousedown', this.props.onClickClose, false);
document.removeEventListener('keyup', this.props.onClickClose, false); document.removeEventListener('keyup', this.props.onClickClose, false);
}, },

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

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

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

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

Loading…
Cancel
Save