select search query on focus

This commit is contained in:
Bruno Windels 2018-12-18 16:35:07 +01:00
parent 0676c1b8ad
commit dd6dd7a4fc

View file

@ -56,7 +56,6 @@ module.exports = React.createClass({
case 'focus_room_filter': case 'focus_room_filter':
if (this.refs.search) { if (this.refs.search) {
this.refs.search.focus(); this.refs.search.focus();
this.refs.search.select();
} }
break; break;
} }
@ -83,6 +82,10 @@ module.exports = React.createClass({
} }
}, },
_onFocus: function(ev) {
ev.target.select();
},
_clearSearch: function(source) { _clearSearch: function(source) {
this.refs.search.value = ""; this.refs.search.value = "";
this.onChange(); this.onChange();
@ -108,6 +111,7 @@ module.exports = React.createClass({
ref="search" ref="search"
className="mx_textinput_icon mx_textinput_search" className="mx_textinput_icon mx_textinput_search"
value={ this.state.searchTerm } value={ this.state.searchTerm }
onFocus={ this._onFocus }
onChange={ this.onChange } onChange={ this.onChange }
onKeyDown={ this._onKeyDown } onKeyDown={ this._onKeyDown }
placeholder={ _t('Filter room names') } placeholder={ _t('Filter room names') }