PLT-4433 Gave focus to the search box when the direct channels or channel member modal is opened (#4391)
Этот коммит содержится в:
коммит произвёл
Corey Hulen
родитель
3f30aa57ea
Коммит
90a0b1d7c6
@@ -13,6 +13,7 @@ import {searchUsers} from 'actions/user_actions.jsx';
|
|||||||
import {removeUserFromChannel} from 'actions/channel_actions.jsx';
|
import {removeUserFromChannel} from 'actions/channel_actions.jsx';
|
||||||
|
|
||||||
import * as AsyncClient from 'utils/async_client.jsx';
|
import * as AsyncClient from 'utils/async_client.jsx';
|
||||||
|
import * as UserAgent from 'utils/user_agent.jsx';
|
||||||
import * as Utils from 'utils/utils.jsx';
|
import * as Utils from 'utils/utils.jsx';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
@@ -147,6 +148,7 @@ export default class ChannelMembersModal extends React.Component {
|
|||||||
nextPage={this.nextPage}
|
nextPage={this.nextPage}
|
||||||
search={this.search}
|
search={this.search}
|
||||||
actions={removeButton}
|
actions={removeButton}
|
||||||
|
focusOnMount={!UserAgent.isMobile()}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import UserStore from 'stores/user_store.jsx';
|
|||||||
import TeamStore from 'stores/team_store.jsx';
|
import TeamStore from 'stores/team_store.jsx';
|
||||||
|
|
||||||
import * as AsyncClient from 'utils/async_client.jsx';
|
import * as AsyncClient from 'utils/async_client.jsx';
|
||||||
|
import * as UserAgent from 'utils/user_agent.jsx';
|
||||||
import * as Utils from 'utils/utils.jsx';
|
import * as Utils from 'utils/utils.jsx';
|
||||||
import Constants from 'utils/constants.jsx';
|
import Constants from 'utils/constants.jsx';
|
||||||
|
|
||||||
@@ -258,6 +259,7 @@ export default class MoreDirectChannels extends React.Component {
|
|||||||
nextPage={this.nextPage}
|
nextPage={this.nextPage}
|
||||||
search={this.search}
|
search={this.search}
|
||||||
actions={[this.createJoinDirectChannelButton]}
|
actions={[this.createJoinDirectChannelButton]}
|
||||||
|
focusOnMount={!UserAgent.isMobile()}
|
||||||
/>
|
/>
|
||||||
</Modal.Body>
|
</Modal.Body>
|
||||||
<Modal.Footer>
|
<Modal.Footer>
|
||||||
|
|||||||
@@ -33,6 +33,12 @@ export default class SearchableUserList extends React.Component {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
if (this.props.focusOnMount) {
|
||||||
|
this.refs.filter.focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
componentDidUpdate(prevProps, prevState) {
|
componentDidUpdate(prevProps, prevState) {
|
||||||
if (this.state.page !== prevState.page) {
|
if (this.state.page !== prevState.page) {
|
||||||
$(ReactDOM.findDOMNode(this.refs.userList)).scrollTop(0);
|
$(ReactDOM.findDOMNode(this.refs.userList)).scrollTop(0);
|
||||||
@@ -209,7 +215,8 @@ SearchableUserList.defaultProps = {
|
|||||||
actions: [],
|
actions: [],
|
||||||
actionProps: {},
|
actionProps: {},
|
||||||
actionUserProps: {},
|
actionUserProps: {},
|
||||||
showTeamToggle: false
|
showTeamToggle: false,
|
||||||
|
focusOnMount: false
|
||||||
};
|
};
|
||||||
|
|
||||||
SearchableUserList.propTypes = {
|
SearchableUserList.propTypes = {
|
||||||
@@ -222,5 +229,6 @@ SearchableUserList.propTypes = {
|
|||||||
actions: React.PropTypes.arrayOf(React.PropTypes.func),
|
actions: React.PropTypes.arrayOf(React.PropTypes.func),
|
||||||
actionProps: React.PropTypes.object,
|
actionProps: React.PropTypes.object,
|
||||||
actionUserProps: React.PropTypes.object,
|
actionUserProps: React.PropTypes.object,
|
||||||
style: React.PropTypes.object
|
style: React.PropTypes.object,
|
||||||
|
focusOnMount: React.PropTypes.bool.isRequired
|
||||||
};
|
};
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user