From 8ea0a0d60d47c06dda440ca099a9a3b54d121072 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sat, 11 Jul 2020 19:08:54 -0400 Subject: [PATCH] Only focus on reply commentform textareas. Fixes #944 --- ui/src/components/comment-form.tsx | 5 ++++- ui/src/components/comment-node.tsx | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ui/src/components/comment-form.tsx b/ui/src/components/comment-form.tsx index 04720cbb0..00b4fe1ef 100644 --- a/ui/src/components/comment-form.tsx +++ b/ui/src/components/comment-form.tsx @@ -33,6 +33,7 @@ interface CommentFormProps { onReplyCancel?(): any; edit?: boolean; disabled?: boolean; + focus?: boolean; } interface CommentFormState { @@ -122,7 +123,9 @@ export class CommentForm extends Component { setTimeout(() => autosize.update(textarea), 10); } - textarea.focus(); + if (this.props.focus) { + textarea.focus(); + } } } diff --git a/ui/src/components/comment-node.tsx b/ui/src/components/comment-node.tsx index 8e976e7cc..82af0bbe0 100644 --- a/ui/src/components/comment-node.tsx +++ b/ui/src/components/comment-node.tsx @@ -229,6 +229,7 @@ export class CommentNode extends Component { edit onReplyCancel={this.handleReplyCancel} disabled={this.props.locked} + focus /> )} {!this.state.showEdit && !this.state.collapsed && ( @@ -697,6 +698,7 @@ export class CommentNode extends Component { node={node} onReplyCancel={this.handleReplyCancel} disabled={this.props.locked} + focus /> )} {node.children && !this.state.collapsed && (