From 6849bc6c383bfe030d27088c939a4aa6786b83ff Mon Sep 17 00:00:00 2001 From: Jack Allnutt Date: Thu, 13 Oct 2011 01:11:58 +0100 Subject: [PATCH] Instead of stealing focus from the channel/query window on click, forward keyboard events to the msg input box and transfer focus gracefully. Fix for Issue #49, where the user is unable to highlight/copy etc text from the window. --- client/js/front.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/client/js/front.js b/client/js/front.js index ce8f869..55bf7a6 100644 --- a/client/js/front.js +++ b/client/js/front.js @@ -75,7 +75,8 @@ kiwi.front = { netssl = $('#kiwi .formconnectwindow .ssl'), netpass = $('#kiwi .formconnectwindow .password'), nick = $('#kiwi .formconnectwindow .nick'), - tmp; + tmp, + forwardKeys; if (nick.val() === '') { nick.val('Nick please!'); @@ -96,7 +97,16 @@ kiwi.front = { } $('#kiwi .connectwindow').slideUp('', kiwi.front.ui.barsShow); - $('#windows').click(function () { $('#kiwi_msginput').focus(); }); + + // Listen for keyboard activity on any window, and forward it to the input box so users can type even if the input box is not in focus + forwardKeys = function (event) { + $('#kiwi_msginput').focus(); + $('#kiwi_msginput').trigger(event); + }; + $('#kiwi_msginput').attr('tabindex', 0); + $('#kiwi_msginput').focus(); + $('#windows').attr('tabindex',100); + $('#windows').keydown(forwardKeys).keypress(forwardKeys).keyup(forwardKeys); return false; }); -- 2.25.1