]> Untitled Git - lemmy.git/commitdiff
Comment box focus (#947)
authorDessalines <dessalines@users.noreply.github.com>
Sun, 12 Jul 2020 01:47:38 +0000 (21:47 -0400)
committerGitHub <noreply@github.com>
Sun, 12 Jul 2020 01:47:38 +0000 (21:47 -0400)
* Add fallback url to fuse devserver(closes #945)

* Only focus on reply commentform textareas. Fixes #944

Co-authored-by: Justin Hernandez <jmarthernandez@gmail.com>
ui/src/components/comment-form.tsx
ui/src/components/comment-node.tsx

index 04720cbb0a2164fc78339aa36cab9da5ccef70df..00b4fe1ef703c4a7060e6ae7d17da1f2a7f0a65b 100644 (file)
@@ -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<CommentFormProps, CommentFormState> {
         setTimeout(() => autosize.update(textarea), 10);
       }
 
-      textarea.focus();
+      if (this.props.focus) {
+        textarea.focus();
+      }
     }
   }
 
index 8e976e7cc8d4bcd6c57f3de62f459faaf28e4dae..82af0bbe00d4ce7ceb51cd0bcea730900a24952f 100644 (file)
@@ -229,6 +229,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
                 edit
                 onReplyCancel={this.handleReplyCancel}
                 disabled={this.props.locked}
+                focus
               />
             )}
             {!this.state.showEdit && !this.state.collapsed && (
@@ -697,6 +698,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
             node={node}
             onReplyCancel={this.handleReplyCancel}
             disabled={this.props.locked}
+            focus
           />
         )}
         {node.children && !this.state.collapsed && (