From e1512e3776a2a531039d79e326c68d035f82ff1e Mon Sep 17 00:00:00 2001 From: damencho Date: Wed, 14 Sep 2016 15:26:38 -0500 Subject: [PATCH] Fixes focusing on write area or nickname input when chat is open. --- modules/UI/side_pannels/chat/Chat.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/UI/side_pannels/chat/Chat.js b/modules/UI/side_pannels/chat/Chat.js index 8e62c851f..00b2724de 100644 --- a/modules/UI/side_pannels/chat/Chat.js +++ b/modules/UI/side_pannels/chat/Chat.js @@ -179,6 +179,13 @@ var Chat = { unreadMessages = 0; updateVisualNotification(); + + // if we are in conversation mode focus on the text input + // if we are not, focus on the display name input + if (APP.settings.getDisplayName()) + $('#usermsg').focus(); + else + $('#nickinput').focus(); }); addSmileys(); @@ -259,12 +266,18 @@ var Chat = { /** * Sets the chat conversation mode. + * Conversation mode is the normal chat mode, non conversation mode is + * where we ask user to input its display name. * @param {boolean} isConversationMode if chat should be in * conversation mode or not. */ setChatConversationMode (isConversationMode) { $('#' + CHAT_CONTAINER_ID) .toggleClass('is-conversation-mode', isConversationMode); + + // this is needed when we transition from no conversation mode to + // conversation mode. When user enters his nickname and hits enter, + // to focus on the write area. if (isConversationMode) { $('#usermsg').focus(); }