Skip to content

Commit

Permalink
Auto focus search box in admin console (mattermost#3013)
Browse files Browse the repository at this point in the history
  • Loading branch information
jespino committed Jun 27, 2019
1 parent 6a9b607 commit c721200
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions components/admin_console/admin_sidebar/admin_sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,18 @@ export default class AdminSidebar extends React.Component {
filter: '',
};
this.idx = null;
this.searchRef = React.createRef();
}

componentDidMount() {
if (this.props.config.PluginSettings.Enable) {
this.props.actions.getPlugins();
}

if (this.searchRef.current) {
this.searchRef.current.focus();
}

this.updateTitle();

if (!Utils.isMobile()) {
Expand Down Expand Up @@ -294,6 +299,7 @@ export default class AdminSidebar extends React.Component {
onChange={this.onFilterChange}
value={this.state.filter}
placeholder={Utils.localizeMessage('admin.sidebar.filter', 'Find settings')}
ref={this.searchRef}
/>
{this.state.filter &&
<div
Expand Down

0 comments on commit c721200

Please sign in to comment.