Instead of stealing focus from the channel/query window on click, forward keyboard...
authorJack Allnutt <m2ys4u@Gmail.com>
Thu, 13 Oct 2011 00:11:58 +0000 (01:11 +0100)
committerJack Allnutt <m2ys4u@Gmail.com>
Thu, 13 Oct 2011 00:11:58 +0000 (01:11 +0100)
Fix for Issue #49, where the user is unable to highlight/copy etc text from the window.

client/js/front.js

index ce8f869d5fbb672b5525675881ad29255a150ead..55bf7a6960fdcd876054f92da25a53b6cd6b11ae 100644 (file)
@@ -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;
         });