Procházet zdrojové kódy

Merge pull request #590 from rlanvin/no-focus-stealing

Don't steal focus when chatbox is opened automatically
JC Brand před 9 roky
rodič
revize
894bc41a0f
2 změnil soubory, kde provedl 7 přidání a 6 odebrání
  1. 6 6
      converse.js
  2. 1 0
      docs/CHANGES.md

+ 6 - 6
converse.js

@@ -2174,22 +2174,22 @@
                 return this;
             },
 
-            show: function (callback) {
+            show: function (focus) {
                 if (this.$el.is(':visible') && this.$el.css('opacity') === "1") {
                     return this.focus();
                 }
                 this.initDragResize().setDimensions();
                 this.$el.fadeIn(function () {
-                    if (typeof callback === "function") {
-                        callback.apply(this, arguments);
-                    }
                     if (converse.connection.connected) {
                         // Without a connection, we haven't yet initialized
                         // localstorage
                         this.model.save();
                     }
                     this.setChatState(ACTIVE);
-                    this.scrollDown().focus();
+                    this.scrollDown();
+                    if ( focus ) {
+                        this.focus();
+                    }
                 }.bind(this));
                 return this;
             },
@@ -3923,7 +3923,7 @@
                 if (chatbox.get('minimized')) {
                     chatbox.maximize();
                 } else {
-                    chatbox.trigger('show');
+                    chatbox.trigger('show', true);
                 }
                 return chatbox;
             }

+ 1 - 0
docs/CHANGES.md

@@ -5,6 +5,7 @@
 - #261 show_controlbox_by_default config not working [diditopher]
 - #573 xgettext build error: `'javascript' unknown`
 - Save scroll position on minimize and restore it on maximize [rlanvin]
+- #566 Do not steal the focus when the chatbox opens automatically [rlanvin]
 
 ## 0.10.1 (2016-02-06)