Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Revert "Merge pull request #867 from matrix-org/t3chguy/BaseDialog-pa…
Browse files Browse the repository at this point in the history
…tch1"

This reverts commit 3549ff2, reversing
changes made to 1db6771.
  • Loading branch information
dbkr committed May 16, 2017
1 parent c15a67a commit 6bd7af2
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/components/views/dialogs/BaseDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
// will focus another element which will receive future key events
_onKeyUp: function(e) {
if (e.keyCode === KeyCode.ESCAPE) {
e.stopPropagation();
e.preventDefault();
this.props.onFinished();
} else if (e.keyCode === KeyCode.ENTER) {
if (this.props.onEnterPressed) {
e.stopPropagation();
e.preventDefault();
this.props.onEnterPressed(e);
}
}
// Consume all keyup events while Modal is open
e.stopPropagation();
},

_onCancelClick: function(e) {
Expand All @@ -86,11 +81,7 @@ export default React.createClass({
const TintableSvg = sdk.getComponent("elements.TintableSvg");

return (
<div onKeyUp={this._onKeyUp}
onKeyDown={this._eatKeyEvent}
onKeyPress={this._eatKeyEvent}
className={this.props.className}
>
<div onKeyUp={this._onKeyUp} className={this.props.className}>
<AccessibleButton onClick={this._onCancelClick}
className="mx_Dialog_cancelButton"
>
Expand Down

0 comments on commit 6bd7af2

Please sign in to comment.