Skip to content

Commit 53fd3f5

Browse files
committed
Oops, onChange doesn't catch the enter key
1 parent d0618c4 commit 53fd3f5

1 file changed

Lines changed: 18 additions & 16 deletions

File tree

‎src/components/structures/RoomDirectory.js‎

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -215,22 +215,24 @@ module.exports = React.createClass({
215215
onFilterChange: function(ev) {
216216
const alias = ev.target.value;
217217

218+
this.filterString = alias || null;
219+
220+
// don't send the request for a little bit,
221+
// no point hammering the server with a
222+
// request for every keystroke, let the
223+
// user finish typing.
224+
if (this.filterTimeout) {
225+
clearTimeout(this.filterTimeout);
226+
}
227+
this.filterTimeout = setTimeout(() => {
228+
this.filterTimeout = null;
229+
this.refreshRoomList();
230+
}, 300);
231+
},
232+
233+
onFilterKeyUp: function(ev) {
218234
if (ev.key == "Enter") {
219-
this.showRoomAlias(alias);
220-
} else {
221-
this.filterString = alias || null;
222-
223-
// don't send the request for a little bit,
224-
// no point hammering the server with a
225-
// request for every keystroke, let the
226-
// user finish typing.
227-
if (this.filterTimeout) {
228-
clearTimeout(this.filterTimeout);
229-
}
230-
this.filterTimeout = setTimeout(() => {
231-
this.filterTimeout = null;
232-
this.refreshRoomList();
233-
}, 300);
235+
this.showRoomAlias(ev.target.value);
234236
}
235237
},
236238

@@ -397,7 +399,7 @@ module.exports = React.createClass({
397399
<div className="mx_RoomDirectory_list">
398400
<div className="mx_RoomDirectory_listheader">
399401
<input type="text" placeholder="Find a room by keyword or room ID (#foo:matrix.org)"
400-
className="mx_RoomDirectory_input" size="64" onChange={this.onFilterChange}
402+
className="mx_RoomDirectory_input" size="64" onChange={this.onFilterChange} onKeyUp={this.onFilterKeyUp}
401403
/>
402404
<NetworkDropdown config={this.props.config} onNetworkChange={this.onNetworkChange} />
403405
</div>

0 commit comments

Comments
 (0)