From 52f050b5f98f722fe3ab031dfc6758f182d31b4f Mon Sep 17 00:00:00 2001 From: wmwragg Date: Tue, 6 Sep 2016 17:20:37 +0100 Subject: [PATCH] Better scrolling UX, and fixed bug which created a room when no address supplied --- src/components/views/dialogs/ChatInviteDialog.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/views/dialogs/ChatInviteDialog.js b/src/components/views/dialogs/ChatInviteDialog.js index 56ad0ad6f2..64452f34d7 100644 --- a/src/components/views/dialogs/ChatInviteDialog.js +++ b/src/components/views/dialogs/ChatInviteDialog.js @@ -71,14 +71,17 @@ module.exports = React.createClass({ componentDidUpdate: function() { // As the user scrolls with the arrow keys keep the selected item // at the top of the window. Each item is 29px high. - this.scrollElement.scrollTop = this.state.selected * 29; + this.scrollElement.scrollTop = (this.state.selected * 29) - 29; }, onStartChat: function() { if (this.state.user) { this._startChat(this.state.user.userId); - } else { + } else if (this.refs.textinput.value.length > 0) { this._startChat(this.refs.textinput.value); + } else { + // Nothing to do, so focus back on the textinput + this.refs.textinput.focus(); } }, @@ -247,8 +250,7 @@ module.exports = React.createClass({ onChange={this.onQueryChanged} placeholder={this.props.placeholder} defaultValue={this.props.value} - autoFocus={this.props.focus} - onKeyDown={this.onKeyDown}> + autoFocus={this.props.focus}> ); } @@ -264,7 +266,7 @@ module.exports = React.createClass({ } return ( -
+
{this.props.title}