From 53fd3f52faa6dc7aa9b43ed5254714160aeed3ec Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 16 Sep 2016 20:56:14 +0100 Subject: [PATCH] Oops, onChange doesn't catch the enter key --- src/components/structures/RoomDirectory.js | 34 ++++++++++++---------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/components/structures/RoomDirectory.js b/src/components/structures/RoomDirectory.js index 716d25840..95e2f71c5 100644 --- a/src/components/structures/RoomDirectory.js +++ b/src/components/structures/RoomDirectory.js @@ -215,22 +215,24 @@ module.exports = React.createClass({ onFilterChange: function(ev) { const alias = ev.target.value; - if (ev.key == "Enter") { - this.showRoomAlias(alias); - } else { - this.filterString = alias || null; + this.filterString = alias || null; - // don't send the request for a little bit, - // no point hammering the server with a - // request for every keystroke, let the - // user finish typing. - if (this.filterTimeout) { - clearTimeout(this.filterTimeout); - } - this.filterTimeout = setTimeout(() => { - this.filterTimeout = null; - this.refreshRoomList(); - }, 300); + // don't send the request for a little bit, + // no point hammering the server with a + // request for every keystroke, let the + // user finish typing. + if (this.filterTimeout) { + clearTimeout(this.filterTimeout); + } + this.filterTimeout = setTimeout(() => { + this.filterTimeout = null; + this.refreshRoomList(); + }, 300); + }, + + onFilterKeyUp: function(ev) { + if (ev.key == "Enter") { + this.showRoomAlias(ev.target.value); } }, @@ -397,7 +399,7 @@ module.exports = React.createClass({