From: Dessalines Date: Sun, 12 Jul 2020 01:47:38 +0000 (-0400) Subject: Comment box focus (#947) X-Git-Url: http://these/git/%22https:/join-lemmy.org/%22%7B%7D/%22%7Burl%7D/%22?a=commitdiff_plain;h=74655de6180d53e8c5f7a4cf156b471de181bf21;p=lemmy.git Comment box focus (#947) * Add fallback url to fuse devserver(closes #945) * Only focus on reply commentform textareas. Fixes #944 Co-authored-by: Justin Hernandez --- diff --git a/ui/src/components/comment-form.tsx b/ui/src/components/comment-form.tsx index 04720cbb..00b4fe1e 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 8e976e7c..82af0bbe 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 && (