PLT-3707 Refocus post textbox when channel switcher exits (#3955)

This commit is contained in:
enahum 2016-09-06 10:57:50 -03:00 committed by Harrison Healey
parent ea52b2a1ad
commit 50ea0b5cc4

View file

@ -16,7 +16,7 @@ import * as Utils from 'utils/utils.jsx';
import * as ChannelActions from 'actions/channel_actions.jsx';
import React from 'react';
import $ from 'jquery';
export default class SwitchChannelModal extends React.Component {
constructor() {
super();
@ -24,6 +24,7 @@ export default class SwitchChannelModal extends React.Component {
this.onInput = this.onInput.bind(this);
this.onShow = this.onShow.bind(this);
this.onHide = this.onHide.bind(this);
this.onExited = this.onExited.bind(this);
this.handleKeyDown = this.handleKeyDown.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
this.suggestionProviders = [new SwitchChannelProvider()];
@ -57,6 +58,12 @@ export default class SwitchChannelModal extends React.Component {
this.props.onHide();
}
onExited() {
setTimeout(() => {
$('#post_textbox').get(0).focus();
});
}
onInput(e) {
this.setState({text: e.target.value});
}
@ -99,6 +106,7 @@ export default class SwitchChannelModal extends React.Component {
ref='modal'
show={this.props.show}
onHide={this.onHide}
onExited={this.onExited}
>
<Modal.Header closeButton={true}>
<Modal.Title>