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_post.jsx | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

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

diff --git a/web/react/components/create_post.jsx b/web/react/components/create_post.jsx
index 6ea80cd13..ecabdaee6 100644
--- a/web/react/components/create_post.jsx
+++ b/web/react/components/create_post.jsx
@@ -63,6 +63,7 @@ class CreatePost extends React.Component {
         this.getFileCount = this.getFileCount.bind(this);
         this.handleKeyDown = this.handleKeyDown.bind(this);
         this.sendMessage = this.sendMessage.bind(this);
+        this.focusTextbox = this.focusTextbox.bind(this);
 
         PostStore.clearDraftUploads();
 
@@ -193,6 +194,11 @@ class CreatePost extends React.Component {
             }
         );
     }
+    focusTextbox() {
+        if (!Utils.isMobile()) {
+            this.refs.textbox.focus();
+        }
+    }
     postMsgKeyPress(e) {
         if (this.state.ctrlSend && e.ctrlKey || !this.state.ctrlSend) {
             if (e.which === KeyCodes.ENTER && !e.shiftKey && !e.altKey) {
@@ -216,7 +222,7 @@ class CreatePost extends React.Component {
         PostStore.storeCurrentDraft(draft);
     }
     handleUploadClick() {
-        this.refs.textbox.focus();
+        this.focusTextbox();
     }
     handleUploadStart(clientIds, channelId) {
         const draft = PostStore.getDraft(channelId);
@@ -228,7 +234,7 @@ class CreatePost 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, channelId) {
         const draft = PostStore.getDraft(channelId);
@@ -305,11 +311,12 @@ class CreatePost extends React.Component {
     componentDidMount() {
         ChannelStore.addChangeListener(this.onChange);
         PreferenceStore.addChangeListener(this.onPreferenceChange);
-        this.refs.textbox.focus();
+
+        this.focusTextbox();
     }
     componentDidUpdate(prevProps, prevState) {
         if (prevState.channelId !== this.state.channelId) {
-            this.refs.textbox.focus();
+            this.focusTextbox();
         }
     }
     componentWillUnmount() {
-- 
cgit v1.2.3-1-g7c22

