From bb3538e27070425a9cfd4cb110abd86bcada9094 Mon Sep 17 00:00:00 2001 From: chylex <contact@chylex.com> Date: Sun, 30 Jul 2017 20:36:17 +0200 Subject: [PATCH] Refocus tweet textarea after selecting a different account Closes #156 --- Resources/Scripts/code.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Resources/Scripts/code.js b/Resources/Scripts/code.js index ade007cd..4a26f7f6 100644 --- a/Resources/Scripts/code.js +++ b/Resources/Scripts/code.js @@ -604,16 +604,18 @@ })(); // - // Block: Swap shift key functionality for selecting accounts. + // Block: Swap shift key functionality for selecting accounts, and refocus the textbox afterwards. // onAppReady.push(function(){ - var toggleEventShiftKey = function(e){ + var onAccountClick = function(e){ if ($TDX.switchAccountSelectors){ e.shiftKey = !e.shiftKey; } + + $(".js-compose-text", ".js-docked-compose").focus(); }; - $(".js-drawer[data-drawer='compose']").delegate(".js-account-list > .js-account-item", "click", toggleEventShiftKey); + $(".js-drawer[data-drawer='compose']").delegate(".js-account-list > .js-account-item", "click", onAccountClick); if (!ensurePropertyExists(TD, "components", "AccountSelector", "prototype", "refreshPostingAccounts")){ return; @@ -622,7 +624,7 @@ TD.components.AccountSelector.prototype.refreshPostingAccounts = appendToFunction(TD.components.AccountSelector.prototype.refreshPostingAccounts, function(){ if (!this.$node.attr("td-account-selector-hook")){ this.$node.attr("td-account-selector-hook", "1"); - this.$node.delegate(".js-account-item", "click", toggleEventShiftKey); + this.$node.delegate(".js-account-item", "click", onAccountClick); } }); });