Revert "Merge pull request #867 from matrix-org/t3chguy/BaseDialog-patch1"

This reverts commit 3549ff2543, reversing
changes made to 1db677141e.
This commit is contained in:
David Baker 2017-05-16 14:00:09 +01:00
parent c15a67a8d8
commit 6bd7af2917

View file

@ -57,25 +57,20 @@ export default React.createClass({
} }
}, },
// Don't let key{down,press} events escape the modal. Consume them all.
_eatKeyEvent: function(e) {
e.stopPropagation();
},
// Must be when the key is released (and not pressed) otherwise componentWillUnmount // Must be when the key is released (and not pressed) otherwise componentWillUnmount
// will focus another element which will receive future key events // will focus another element which will receive future key events
_onKeyUp: function(e) { _onKeyUp: function(e) {
if (e.keyCode === KeyCode.ESCAPE) { if (e.keyCode === KeyCode.ESCAPE) {
e.stopPropagation();
e.preventDefault(); e.preventDefault();
this.props.onFinished(); this.props.onFinished();
} else if (e.keyCode === KeyCode.ENTER) { } else if (e.keyCode === KeyCode.ENTER) {
if (this.props.onEnterPressed) { if (this.props.onEnterPressed) {
e.stopPropagation();
e.preventDefault(); e.preventDefault();
this.props.onEnterPressed(e); this.props.onEnterPressed(e);
} }
} }
// Consume all keyup events while Modal is open
e.stopPropagation();
}, },
_onCancelClick: function(e) { _onCancelClick: function(e) {
@ -86,11 +81,7 @@ export default React.createClass({
const TintableSvg = sdk.getComponent("elements.TintableSvg"); const TintableSvg = sdk.getComponent("elements.TintableSvg");
return ( return (
<div onKeyUp={this._onKeyUp} <div onKeyUp={this._onKeyUp} className={this.props.className}>
onKeyDown={this._eatKeyEvent}
onKeyPress={this._eatKeyEvent}
className={this.props.className}
>
<AccessibleButton onClick={this._onCancelClick} <AccessibleButton onClick={this._onCancelClick}
className="mx_Dialog_cancelButton" className="mx_Dialog_cancelButton"
> >