summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2016-01-25 10:19:22 -0500
committerChristopher Speller <crspeller@gmail.com>2016-01-25 10:19:22 -0500
commit2fcba4f3ddd132ada496a8cf9d8a1d69ba423b1a (patch)
tree33ddc66cb26b58c90d62548123ef8f298a05e088 /web
parent93a4e85c2d183a48f84a269c38ad4b91e9c31c14 (diff)
parentc408e09a0418c77e1f1f0a91a1c85bf5f20145e7 (diff)
downloadchat-2fcba4f3ddd132ada496a8cf9d8a1d69ba423b1a.tar.gz
chat-2fcba4f3ddd132ada496a8cf9d8a1d69ba423b1a.tar.bz2
chat-2fcba4f3ddd132ada496a8cf9d8a1d69ba423b1a.zip
Merge pull request #1936 from rgarmsen2295/plt-1654
PLT-1654 Fixed issue with enter key not working in delete post modal
Diffstat (limited to 'web')
-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>