Merge pull request #1936 from rgarmsen2295/plt-1654
PLT-1654 Fixed issue with enter key not working in delete post modal
Этот коммит содержится в:
@@ -23,7 +23,7 @@ export default class DeletePostModal extends React.Component {
|
|||||||
this.selectedList = null;
|
this.selectedList = null;
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
show: true,
|
show: false,
|
||||||
post: null,
|
post: null,
|
||||||
commentCount: 0,
|
commentCount: 0,
|
||||||
error: ''
|
error: ''
|
||||||
@@ -40,6 +40,14 @@ export default class DeletePostModal extends React.Component {
|
|||||||
ModalStore.removeModalListener(ActionTypes.TOGGLE_DELETE_POST_MODAL, this.handleToggle);
|
ModalStore.removeModalListener(ActionTypes.TOGGLE_DELETE_POST_MODAL, this.handleToggle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidUpdate(prevProps, prevState) {
|
||||||
|
if (this.state.show && !prevState.show) {
|
||||||
|
setTimeout(() => {
|
||||||
|
$(ReactDOM.findDOMNode(this.refs.deletePostBtn)).focus();
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
handleDelete() {
|
handleDelete() {
|
||||||
Client.deletePost(
|
Client.deletePost(
|
||||||
this.state.post.channel_id,
|
this.state.post.channel_id,
|
||||||
@@ -149,10 +157,10 @@ export default class DeletePostModal extends React.Component {
|
|||||||
{'Cancel'}
|
{'Cancel'}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
|
ref='deletePostBtn'
|
||||||
type='button'
|
type='button'
|
||||||
className='btn btn-danger'
|
className='btn btn-danger'
|
||||||
onClick={this.handleDelete}
|
onClick={this.handleDelete}
|
||||||
autoFocus='autofocus'
|
|
||||||
>
|
>
|
||||||
{'Delete'}
|
{'Delete'}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user