diff options
author | Ryan Wang <R-Wang97@users.noreply.github.com> | 2017-03-07 19:17:11 -0500 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2017-03-07 19:17:11 -0500 |
commit | fa04d2bf3a810912594d2d9d9f13bbd67ebca7a1 (patch) | |
tree | 94124bccef6536efcfe565a96e44753dcffa2b78 /webapp | |
parent | 83291e4c8fd1c2d234ac9f4254af849bed64cabf (diff) | |
download | chat-fa04d2bf3a810912594d2d9d9f13bbd67ebca7a1.tar.gz chat-fa04d2bf3a810912594d2d9d9f13bbd67ebca7a1.tar.bz2 chat-fa04d2bf3a810912594d2d9d9f13bbd67ebca7a1.zip |
'Add Members' Modal Focuses Searchbar Fix (#5608)
Diffstat (limited to 'webapp')
-rw-r--r-- | webapp/components/searchable_user_list.jsx | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/webapp/components/searchable_user_list.jsx b/webapp/components/searchable_user_list.jsx index d25c8a506..ab3f9ee9b 100644 --- a/webapp/components/searchable_user_list.jsx +++ b/webapp/components/searchable_user_list.jsx @@ -19,6 +19,7 @@ export default class SearchableUserList extends React.Component { this.nextPage = this.nextPage.bind(this); this.previousPage = this.previousPage.bind(this); this.doSearch = this.doSearch.bind(this); + this.focusSearchBar = this.focusSearchBar.bind(this); this.nextTimeoutId = 0; @@ -30,15 +31,14 @@ export default class SearchableUserList extends React.Component { } componentDidMount() { - if (this.props.focusOnMount) { - this.refs.filter.focus(); - } + this.focusSearchBar(); } componentDidUpdate(prevProps, prevState) { if (this.state.page !== prevState.page) { $(ReactDOM.findDOMNode(this.refs.userList)).scrollTop(0); } + this.focusSearchBar(); } componentWillUnmount() { @@ -57,6 +57,12 @@ export default class SearchableUserList extends React.Component { this.setState({page: this.state.page - 1}); } + focusSearchBar() { + if (this.props.focusOnMount) { + this.refs.filter.focus(); + } + } + doSearch() { const term = this.refs.filter.value; this.props.search(term); |