Add exitToDirectChannel to more_direct_channels (#4336)
When a new channel is selected, we set `exitToDirectChannel` to the newly selected channel. In `handleExit` if `exitToDirectChannel` exists, the new channel information is pushed. This fixes an issue where the create_post textarea gains and then loses focus due to the way that react-overlays (react-bootstrap dependency) handles previous focus which in this particular case is the `More...` link.
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
54277eae28
Коммит
60a92f0a27
@@ -26,6 +26,7 @@ export default class MoreDirectChannels extends React.Component {
|
|||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.handleHide = this.handleHide.bind(this);
|
this.handleHide = this.handleHide.bind(this);
|
||||||
|
this.handleExit = this.handleExit.bind(this);
|
||||||
this.handleShowDirectChannel = this.handleShowDirectChannel.bind(this);
|
this.handleShowDirectChannel = this.handleShowDirectChannel.bind(this);
|
||||||
this.onChange = this.onChange.bind(this);
|
this.onChange = this.onChange.bind(this);
|
||||||
this.createJoinDirectChannelButton = this.createJoinDirectChannelButton.bind(this);
|
this.createJoinDirectChannelButton = this.createJoinDirectChannelButton.bind(this);
|
||||||
@@ -70,6 +71,12 @@ export default class MoreDirectChannels extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleExit() {
|
||||||
|
if (this.exitToDirectChannel) {
|
||||||
|
browserHistory.push(this.exitToDirectChannel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
handleShowDirectChannel(teammate, e) {
|
handleShowDirectChannel(teammate, e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
@@ -81,7 +88,10 @@ export default class MoreDirectChannels extends React.Component {
|
|||||||
openDirectChannelToUser(
|
openDirectChannelToUser(
|
||||||
teammate,
|
teammate,
|
||||||
(channel) => {
|
(channel) => {
|
||||||
browserHistory.push(TeamStore.getCurrentTeamUrl() + '/channels/' + channel.name);
|
// Due to how react-overlays Modal handles focus, we delay pushing
|
||||||
|
// the new channel information until the modal is fully exited.
|
||||||
|
// The channel information will be pushed in `handleExit`
|
||||||
|
this.exitToDirectChannel = TeamStore.getCurrentTeamRelativeUrl() + '/channels/' + channel.name;
|
||||||
this.setState({loadingDMChannel: -1});
|
this.setState({loadingDMChannel: -1});
|
||||||
this.handleHide();
|
this.handleHide();
|
||||||
},
|
},
|
||||||
@@ -228,6 +238,7 @@ export default class MoreDirectChannels extends React.Component {
|
|||||||
dialogClassName='more-modal more-direct-channels'
|
dialogClassName='more-modal more-direct-channels'
|
||||||
show={this.props.show}
|
show={this.props.show}
|
||||||
onHide={this.handleHide}
|
onHide={this.handleHide}
|
||||||
|
onExited={this.handleExit}
|
||||||
>
|
>
|
||||||
<Modal.Header closeButton={true}>
|
<Modal.Header closeButton={true}>
|
||||||
<Modal.Title>
|
<Modal.Title>
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user