Bug 717492 - [New Tab Page] URL bar history pops up when pressing toolbar buttons; r=dao
authorTim Taubert <tim.taubert@gmx.de>
Wed, 25 Jan 2012 23:47:36 +0100
changeset 86795 ab6256b65403a301f57fce6a9fbb6c83445da886
parent 86794 0ab12334bd7e5d2007cb9e74341a453d4a3f5ef0
child 86796 3ef01a0874d140ca0ecb59807c085b96aa95cad5
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao
bugs717492
milestone12.0a1
Bug 717492 - [New Tab Page] URL bar history pops up when pressing toolbar buttons; r=dao
browser/base/content/newtab/toolbar.js
--- a/browser/base/content/newtab/toolbar.js
+++ b/browser/base/content/newtab/toolbar.js
@@ -19,16 +19,26 @@ let gToolbar = {
 
     // Listen for 'click' events on the toolbar buttons.
     ["show", "hide", "reset"].forEach(function (aType, aIndex) {
       let self = this;
       let button = buttons[aIndex];
       let handler = function () self[aType]();
 
       button.addEventListener("click", handler, false);
+
+#ifdef XP_MACOSX
+      // Per default buttons lose focus after being clicked on Mac OS X.
+      // So when the URL bar has focus and a toolbar button is clicked the
+      // URL bar regains focus and the history pops up. We need to prevent
+      // that by explicitly removing its focus.
+      button.addEventListener("mousedown", function () {
+        window.focus();
+      }, false);
+#endif
     }, this);
   },
 
   /**
    * Enables the 'New Tab Page' feature.
    */
   show: function Toolbar_show() {
     this._passButtonFocus("show", "hide");