diff --git a/src/components/views/dialogs/BaseDialog.js b/src/components/views/dialogs/BaseDialog.js index 279dedbd43..02460148b3 100644 --- a/src/components/views/dialogs/BaseDialog.js +++ b/src/components/views/dialogs/BaseDialog.js @@ -57,20 +57,25 @@ 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) { @@ -81,7 +86,11 @@ export default React.createClass({ const TintableSvg = sdk.getComponent("elements.TintableSvg"); return ( -
+