From dd6dd7a4fc6e19ff2d146477c899c4e524483347 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 18 Dec 2018 16:35:07 +0100 Subject: [PATCH] select search query on focus --- src/components/structures/SearchBox.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/structures/SearchBox.js b/src/components/structures/SearchBox.js index 4df3e837c7..ea1fa312c1 100644 --- a/src/components/structures/SearchBox.js +++ b/src/components/structures/SearchBox.js @@ -56,7 +56,6 @@ module.exports = React.createClass({ case 'focus_room_filter': if (this.refs.search) { this.refs.search.focus(); - this.refs.search.select(); } break; } @@ -83,6 +82,10 @@ module.exports = React.createClass({ } }, + _onFocus: function(ev) { + ev.target.select(); + }, + _clearSearch: function(source) { this.refs.search.value = ""; this.onChange(); @@ -108,6 +111,7 @@ module.exports = React.createClass({ ref="search" className="mx_textinput_icon mx_textinput_search" value={ this.state.searchTerm } + onFocus={ this._onFocus } onChange={ this.onChange } onKeyDown={ this._onKeyDown } placeholder={ _t('Filter room names') }