From d494283989752ad3e2dfdd3e06fb36bdd8947780 Mon Sep 17 00:00:00 2001
From: hmhealey <harrisonmhealey@gmail.com>
Date: Fri, 5 Feb 2016 12:22:39 -0500
Subject: Disabled keyboard focus code changes on mobile

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

(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 9e7c67515..709485991 100644
--- a/web/react/components/create_comment.jsx
+++ b/web/react/components/create_comment.jsx
@@ -59,6 +59,7 @@ class CreateComment extends React.Component {
         this.getFileCount = this.getFileCount.bind(this);
         this.handleResize = this.handleResize.bind(this);
         this.onPreferenceChange = this.onPreferenceChange.bind(this);
+        this.focusTextbox = this.focusTextbox.bind(this);
 
         PostStore.clearCommentDraftUploads();
 
@@ -76,7 +77,7 @@ class CreateComment extends React.Component {
         PreferenceStore.addChangeListener(this.onPreferenceChange);
         window.addEventListener('resize', this.handleResize);
 
-        this.refs.textbox.focus();
+        this.focusTextbox();
     }
     componentWillUnmount() {
         PreferenceStore.removeChangeListener(this.onPreferenceChange);
@@ -99,7 +100,7 @@ class CreateComment extends React.Component {
         }
 
         if (prevProps.rootId !== this.props.rootId) {
-            this.refs.textbox.focus();
+            this.focusTextbox();
         }
     }
     handleSubmit(e) {
@@ -226,7 +227,7 @@ class CreateComment extends React.Component {
         }
     }
     handleUploadClick() {
-        this.refs.textbox.focus();
+        this.focusTextbox();
     }
     handleUploadStart(clientIds) {
         let draft = PostStore.getCommentDraft(this.props.rootId);
@@ -238,7 +239,7 @@ class CreateComment extends React.Component {
 
         // 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();
+        this.focusTextbox();
     }
     handleFileUploadComplete(filenames, clientIds) {
         let draft = PostStore.getCommentDraft(this.props.rootId);
@@ -306,6 +307,11 @@ class CreateComment extends React.Component {
     getFileCount() {
         return this.state.previews.length + this.state.uploadsInProgress.length;
     }
+    focusTextbox() {
+        if (!Utils.isMobile()) {
+            this.refs.textbox.focus();
+        }
+    }
     render() {
         let serverError = null;
         if (this.state.serverError) {
-- 
cgit v1.2.3-1-g7c22

