diff --git a/converse.js b/converse.js index 057f9aa36..3c4a4e5ce 100644 --- a/converse.js +++ b/converse.js @@ -1479,11 +1479,12 @@ this.$el.hide('fast', converse.refreshWebkit); converse.emit('onChatBoxClosed', this); } + return this; }, show: function (callback) { if (this.$el.is(':visible') && this.$el.css('opacity') == "1") { - return this; + return this.focus(); } this.$el.show(callback); if (converse.connection) { diff --git a/spec/chatbox.js b/spec/chatbox.js index 7639acb4a..b7d75671b 100644 --- a/spec/chatbox.js +++ b/spec/chatbox.js @@ -35,7 +35,7 @@ // visible, but no other chat boxes have been created. expect(this.chatboxes.length).toEqual(1); - var online_contacts = this.rosterview.$el.find('dt#xmpp-contacts').siblings('dd.current-xmpp-contact.online').find('a.open-chat'); + var online_contacts = this.rosterview.$el.find('dt#xmpp-contacts').siblings('dd.current-xmpp-contact').find('a.open-chat'); for (i=0; i