Adding focus for channel modals
Этот коммит содержится в:
@@ -55,9 +55,13 @@ export default class EditChannelModal extends React.Component {
|
|||||||
const button = e.relatedTarget;
|
const button = e.relatedTarget;
|
||||||
this.setState({header: $(button).attr('data-header'), title: $(button).attr('data-title'), channelId: $(button).attr('data-channelid'), serverError: ''});
|
this.setState({header: $(button).attr('data-header'), title: $(button).attr('data-title'), channelId: $(button).attr('data-channelid'), serverError: ''});
|
||||||
}
|
}
|
||||||
|
handleShown() {
|
||||||
|
$('#edit_channel #edit_header').focus();
|
||||||
|
}
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
$(ReactDOM.findDOMNode(this.refs.modal)).on('show.bs.modal', this.onShow);
|
$(ReactDOM.findDOMNode(this.refs.modal)).on('show.bs.modal', this.onShow);
|
||||||
$(ReactDOM.findDOMNode(this.refs.modal)).on('hidden.bs.modal', this.handleClose);
|
$(ReactDOM.findDOMNode(this.refs.modal)).on('hidden.bs.modal', this.handleClose);
|
||||||
|
$(ReactDOM.findDOMNode(this.refs.modal)).on('shown.bs.modal', this.handleShown);
|
||||||
}
|
}
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
$(ReactDOM.findDOMNode(this.refs.modal)).off('hidden.bs.modal', this.handleClose);
|
$(ReactDOM.findDOMNode(this.refs.modal)).off('hidden.bs.modal', this.handleClose);
|
||||||
@@ -114,6 +118,7 @@ export default class EditChannelModal extends React.Component {
|
|||||||
<textarea
|
<textarea
|
||||||
className='form-control no-resize'
|
className='form-control no-resize'
|
||||||
rows='6'
|
rows='6'
|
||||||
|
id='edit_header'
|
||||||
maxLength='1024'
|
maxLength='1024'
|
||||||
value={this.state.header}
|
value={this.state.header}
|
||||||
onChange={this.handleUserInput}
|
onChange={this.handleUserInput}
|
||||||
|
|||||||
@@ -15,6 +15,12 @@ export default class EditChannelPurposeModal extends React.Component {
|
|||||||
this.state = {serverError: ''};
|
this.state = {serverError: ''};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidUpdate() {
|
||||||
|
if (this.props.show) {
|
||||||
|
$(ReactDOM.findDOMNode(this.refs.purpose)).focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
handleHide() {
|
handleHide() {
|
||||||
this.setState({serverError: ''});
|
this.setState({serverError: ''});
|
||||||
|
|
||||||
@@ -77,6 +83,7 @@ export default class EditChannelPurposeModal extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
className='modal-edit-channel-purpose'
|
className='modal-edit-channel-purpose'
|
||||||
|
ref='modal'
|
||||||
show={this.props.show}
|
show={this.props.show}
|
||||||
onHide={this.handleHide}
|
onHide={this.handleHide}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -118,9 +118,13 @@ export default class RenameChannelModal extends React.Component {
|
|||||||
const button = $(e.relatedTarget);
|
const button = $(e.relatedTarget);
|
||||||
this.setState({displayName: button.attr('data-display'), channelName: button.attr('data-name'), channelId: button.attr('data-channelid')});
|
this.setState({displayName: button.attr('data-display'), channelName: button.attr('data-name'), channelId: button.attr('data-channelid')});
|
||||||
}
|
}
|
||||||
|
handleShown() {
|
||||||
|
$('#rename_channel #display_name').focus();
|
||||||
|
}
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
$(ReactDOM.findDOMNode(this.refs.modal)).on('show.bs.modal', this.handleShow);
|
$(ReactDOM.findDOMNode(this.refs.modal)).on('show.bs.modal', this.handleShow);
|
||||||
$(ReactDOM.findDOMNode(this.refs.modal)).on('hidden.bs.modal', this.handleClose);
|
$(ReactDOM.findDOMNode(this.refs.modal)).on('hidden.bs.modal', this.handleClose);
|
||||||
|
$(ReactDOM.findDOMNode(this.refs.modal)).on('shown.bs.modal', this.handleShown);
|
||||||
}
|
}
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
$(ReactDOM.findDOMNode(this.refs.modal)).off('hidden.bs.modal', this.handleClose);
|
$(ReactDOM.findDOMNode(this.refs.modal)).off('hidden.bs.modal', this.handleClose);
|
||||||
@@ -176,6 +180,7 @@ export default class RenameChannelModal extends React.Component {
|
|||||||
onChange={this.onDisplayNameChange}
|
onChange={this.onDisplayNameChange}
|
||||||
type='text'
|
type='text'
|
||||||
ref='displayName'
|
ref='displayName'
|
||||||
|
id='display_name'
|
||||||
className='form-control'
|
className='form-control'
|
||||||
placeholder='Enter display name'
|
placeholder='Enter display name'
|
||||||
value={this.state.displayName}
|
value={this.state.displayName}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user