From eec9f88110a83083ecd68a1d33e36a65b373bdc5 Mon Sep 17 00:00:00 2001
From: hmhealey <harrisonmhealey@gmail.com>
Date: Thu, 4 Feb 2016 11:28:40 -0500
Subject: Updated RHS textbox to refocus after clicking to upload a file

---
 web/react/components/create_comment.jsx | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'web/react/components/create_comment.jsx')

diff --git a/web/react/components/create_comment.jsx b/web/react/components/create_comment.jsx
index 8c49315e7..387d5bd8b 100644
--- a/web/react/components/create_comment.jsx
+++ b/web/react/components/create_comment.jsx
@@ -51,6 +51,7 @@ class CreateComment extends React.Component {
         this.commentMsgKeyPress = this.commentMsgKeyPress.bind(this);
         this.handleUserInput = this.handleUserInput.bind(this);
         this.handleKeyDown = this.handleKeyDown.bind(this);
+        this.handleUploadClick = this.handleUploadClick.bind(this);
         this.handleUploadStart = this.handleUploadStart.bind(this);
         this.handleFileUploadComplete = this.handleFileUploadComplete.bind(this);
         this.handleUploadError = this.handleUploadError.bind(this);
@@ -218,6 +219,9 @@ class CreateComment extends React.Component {
             });
         }
     }
+    handleUploadClick() {
+        this.refs.textbox.focus();
+    }
     handleUploadStart(clientIds) {
         let draft = PostStore.getCommentDraft(this.props.rootId);
 
@@ -365,6 +369,7 @@ class CreateComment extends React.Component {
                             <FileUpload
                                 ref='fileUpload'
                                 getFileCount={this.getFileCount}
+                                onClick={this.handleUploadClick}
                                 onUploadStart={this.handleUploadStart}
                                 onFileUpload={this.handleFileUploadComplete}
                                 onUploadError={this.handleUploadError}
-- 
cgit v1.2.3-1-g7c22


From c11446657f96a155a5dd0790357c992ed719973e Mon Sep 17 00:00:00 2001
From: hmhealey <harrisonmhealey@gmail.com>
Date: Thu, 4 Feb 2016 11:32:39 -0500
Subject: Added code to refocus on the post/comment textbox after a file is
 drag and dropped

---
 web/react/components/create_comment.jsx | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'web/react/components/create_comment.jsx')

diff --git a/web/react/components/create_comment.jsx b/web/react/components/create_comment.jsx
index 387d5bd8b..797b98ce2 100644
--- a/web/react/components/create_comment.jsx
+++ b/web/react/components/create_comment.jsx
@@ -229,6 +229,10 @@ class CreateComment extends React.Component {
         PostStore.storeCommentDraft(this.props.rootId, draft);
 
         this.setState({uploadsInProgress: draft.uploadsInProgress});
+
+        // this is a bit redundant with the code that sets focus when the file input is clicked,
+        // but this also resets the focus after a drag and drop
+        this.refs.textbox.focus();
     }
     handleFileUploadComplete(filenames, clientIds) {
         let draft = PostStore.getCommentDraft(this.props.rootId);
-- 
cgit v1.2.3-1-g7c22


From c4344f8c02227f77165f4592e0c87c323b7e00f5 Mon Sep 17 00:00:00 2001
From: hmhealey <harrisonmhealey@gmail.com>
Date: Thu, 4 Feb 2016 15:07:06 -0500
Subject: Added focus to the sidebar textbox when it is opened

---
 web/react/components/create_comment.jsx | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'web/react/components/create_comment.jsx')

diff --git a/web/react/components/create_comment.jsx b/web/react/components/create_comment.jsx
index 797b98ce2..9e7c67515 100644
--- a/web/react/components/create_comment.jsx
+++ b/web/react/components/create_comment.jsx
@@ -75,6 +75,8 @@ class CreateComment extends React.Component {
     componentDidMount() {
         PreferenceStore.addChangeListener(this.onPreferenceChange);
         window.addEventListener('resize', this.handleResize);
+
+        this.refs.textbox.focus();
     }
     componentWillUnmount() {
         PreferenceStore.removeChangeListener(this.onPreferenceChange);
@@ -95,6 +97,10 @@ class CreateComment extends React.Component {
                 $('.post-right__scroll').perfectScrollbar('update');
             }
         }
+
+        if (prevProps.rootId !== this.props.rootId) {
+            this.refs.textbox.focus();
+        }
     }
     handleSubmit(e) {
         e.preventDefault();
-- 
cgit v1.2.3-1-g7c22

