summaryrefslogtreecommitdiffstats
path: root/web/react/components/delete_post_modal.jsx
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2016-01-25 11:23:55 -0500
committer=Corey Hulen <corey@hulen.com>2016-01-25 11:23:55 -0500
commitea71731f838fc010cfc7511c09875184d1b2396b (patch)
tree7841e6908a42badb5171760426d2ca5898a76bda /web/react/components/delete_post_modal.jsx
parent6b534f1b0dae2614ec267a82f1c4dc1b096b7b1c (diff)
parent5478ea34e436109ece417c3704a1fa36d3aba4a5 (diff)
downloadchat-ea71731f838fc010cfc7511c09875184d1b2396b.tar.gz
chat-ea71731f838fc010cfc7511c09875184d1b2396b.tar.bz2
chat-ea71731f838fc010cfc7511c09875184d1b2396b.zip
merging
Diffstat (limited to 'web/react/components/delete_post_modal.jsx')
-rw-r--r--web/react/components/delete_post_modal.jsx12
1 files changed, 10 insertions, 2 deletions
diff --git a/web/react/components/delete_post_modal.jsx b/web/react/components/delete_post_modal.jsx
index 827654e1b..4cde5feed 100644
--- a/web/react/components/delete_post_modal.jsx
+++ b/web/react/components/delete_post_modal.jsx
@@ -23,7 +23,7 @@ export default class DeletePostModal extends React.Component {
this.selectedList = null;
this.state = {
- show: true,
+ show: false,
post: null,
commentCount: 0,
error: ''
@@ -40,6 +40,14 @@ export default class DeletePostModal extends React.Component {
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() {
Client.deletePost(
this.state.post.channel_id,
@@ -149,10 +157,10 @@ export default class DeletePostModal extends React.Component {
{'Cancel'}
</button>
<button
+ ref='deletePostBtn'
type='button'
className='btn btn-danger'
onClick={this.handleDelete}
- autoFocus='autofocus'
>
{'Delete'}
</button>