Better scrolling UX, and fixed bug which created a room when no address supplied

This commit is contained in:
wmwragg 2016-09-06 17:20:37 +01:00
parent c03f145f04
commit 52f050b5f9

View File

@ -71,14 +71,17 @@ module.exports = React.createClass({
componentDidUpdate: function() { componentDidUpdate: function() {
// As the user scrolls with the arrow keys keep the selected item // As the user scrolls with the arrow keys keep the selected item
// at the top of the window. Each item is 29px high. // 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() { onStartChat: function() {
if (this.state.user) { if (this.state.user) {
this._startChat(this.state.user.userId); this._startChat(this.state.user.userId);
} else { } else if (this.refs.textinput.value.length > 0) {
this._startChat(this.refs.textinput.value); 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} onChange={this.onQueryChanged}
placeholder={this.props.placeholder} placeholder={this.props.placeholder}
defaultValue={this.props.value} defaultValue={this.props.value}
autoFocus={this.props.focus} autoFocus={this.props.focus}>
onKeyDown={this.onKeyDown}>
</textarea> </textarea>
); );
} }
@ -264,7 +266,7 @@ module.exports = React.createClass({
} }
return ( return (
<div className="mx_ChatInviteDialog"> <div className="mx_ChatInviteDialog" onKeyDown={this.onKeyDown}>
<div className="mx_Dialog_title"> <div className="mx_Dialog_title">
{this.props.title} {this.props.title}
</div> </div>