Focus control input on switching tabs
authorDarren <darren@darrenwhitlen.com>
Sun, 30 Mar 2014 12:03:20 +0000 (13:03 +0100)
committerDarren <darren@darrenwhitlen.com>
Sun, 30 Mar 2014 12:03:20 +0000 (13:03 +0100)
client/src/views/controlbox.js

index 8fb5cb2c08ab668e4f27b688bcca12333a650d36..dbe30ac3e30c28000f113c264a75729b75b8f91f 100644 (file)
@@ -29,6 +29,13 @@ _kiwi.view.ControlBox = Backbone.View.extend({
         _kiwi.app.connections.on('active', function(panel, connection) {
             $('.nick', that.$el).text(connection.get('nick'));
         });
+
+        // Keep focus on the input box as we flick between panels
+        _kiwi.app.panels.bind('active', function (active_panel) {
+            if (active_panel.isChannel() || active_panel.isServer() || active_panel.isQuery()) {
+                that.$('.inp').focus();
+            }
+        });
     },
 
     showNickChange: function (ev) {