Bug 1395871 - Open toolbar menus on mousedown, rather than oncommand. draft
authorZibi Braniecki <zbraniecki@mozilla.com>
Fri, 01 Sep 2017 01:54:34 -0700
changeset 659666 9dd6970bc434360ac037d8378c4f303a94da4627
parent 659233 973e8b890a62aee4b3170558ac3b608928162ef6
child 659667 d51acab19adc1dc08a23cfc8680de3075991f19d
child 659672 22acda504cb17f847a0696b02428c4264c18f442
push id78150
push userbmo:gandalf@aviary.pl
push dateWed, 06 Sep 2017 04:38:40 +0000
bugs1395871
milestone57.0a1
Bug 1395871 - Open toolbar menus on mousedown, rather than oncommand. MozReview-Commit-ID: A3P4QBBgcB8
browser/base/content/browser.xul
browser/components/customizableui/CustomizableUI.jsm
browser/components/search/content/search.xml
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -903,17 +903,17 @@
                        onclick="FullZoom.reset();"
                        tooltip="dynamic-shortcut-tooltip"
                        hidden="true"/>
                 <box id="pageActionSeparator" class="urlbar-page-action"/>
                 <image id="pageActionButton"
                        class="urlbar-icon urlbar-page-action"
                        role="button"
                        tooltiptext="&pageActionButton.tooltip;"
-                       onclick="BrowserPageActions.mainButtonClicked(event);"/>
+                       onmousedown="BrowserPageActions.mainButtonClicked(event);"/>
                 <hbox id="star-button-box"
                       hidden="true"
                       class="urlbar-icon-wrapper urlbar-page-action"
                       role="button"
                       context="pageActionPanelContextMenu"
                       oncontextmenu="BrowserPageActions.onContextMenu(event);"
                       onclick="BrowserPageActions.bookmark.onUrlbarNodeClicked(event);">
                   <image id="star-button"
@@ -938,28 +938,28 @@
         </toolbaritem>
 
         <!-- This is a placeholder for the Downloads Indicator.  It is visible
              during the customization of the toolbar, in the palette, and before
              the Downloads Indicator overlay is loaded. -->
         <toolbarbutton id="downloads-button"
                        class="toolbarbutton-1 chromeclass-toolbar-additional badged-button"
                        key="key_openDownloads"
-                       oncommand="DownloadsIndicatorView.onCommand(event);"
+                       onmousedown="DownloadsIndicatorView.onCommand(event);"
                        ondrop="DownloadsIndicatorView.onDrop(event);"
                        ondragover="DownloadsIndicatorView.onDragOver(event);"
                        ondragenter="DownloadsIndicatorView.onDragOver(event);"
                        label="&downloads.label;"
                        removable="true"
                        cui-areatype="toolbar"
                        tooltip="dynamic-shortcut-tooltip"/>
 
         <toolbarbutton id="library-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
                        removable="true"
-                       oncommand="PanelUI.showSubView('appMenu-libraryView', this, null, event);"
+                       onmousedown="PanelUI.showSubView('appMenu-libraryView', this, null, event);"
                        closemenu="none"
                        cui-areatype="toolbar"
                        tooltiptext="&libraryButton.tooltip;"
                        label="&places.library.title;"/>
 
       </hbox>
 
       <toolbarbutton id="nav-bar-overflow-button"
--- a/browser/components/customizableui/CustomizableUI.jsm
+++ b/browser/components/customizableui/CustomizableUI.jsm
@@ -4151,17 +4151,17 @@ OverflowableToolbar.prototype = {
     let doc = this._toolbar.ownerDocument;
     let window = doc.defaultView;
     window.addEventListener("resize", this);
     window.gNavToolbox.addEventListener("customizationstarting", this);
     window.gNavToolbox.addEventListener("aftercustomization", this);
 
     let chevronId = this._toolbar.getAttribute("overflowbutton");
     this._chevron = doc.getElementById(chevronId);
-    this._chevron.addEventListener("command", this);
+    this._chevron.addEventListener("mousedown", this);
     this._chevron.addEventListener("dragover", this);
     this._chevron.addEventListener("dragend", this);
 
     let panelId = this._toolbar.getAttribute("overflowpanel");
     this._panel = doc.getElementById(panelId);
     this._panel.addEventListener("popuphiding", this);
     CustomizableUIInternal.addPanelCloseListeners(this._panel);
 
@@ -4200,17 +4200,17 @@ OverflowableToolbar.prototype = {
     CustomizableUIInternal.removePanelCloseListeners(this._panel);
   },
 
   handleEvent(aEvent) {
     switch (aEvent.type) {
       case "aftercustomization":
         this._enable();
         break;
-      case "command":
+      case "mousedown":
         if (aEvent.target == this._chevron) {
           this._onClickChevron(aEvent);
         } else {
           this._panel.hidePopup();
         }
         break;
       case "customizationstarting":
         this._disable();
--- a/browser/components/search/content/search.xml
+++ b/browser/components/search/content/search.xml
@@ -544,17 +544,17 @@
 
       <handler event="mousedown" phase="capturing">
       <![CDATA[
         if (event.originalTarget.getAttribute("anonid") == "searchbar-search-button") {
           this._clickClosedPopup = this._textbox.popup._isHiding;
         }
       ]]></handler>
 
-      <handler event="click" button="0">
+      <handler event="mousedown" button="0">
       <![CDATA[
         // Ignore clicks on the search go button.
         if (event.originalTarget.getAttribute("anonid") == "search-go-button") {
           return;
         }
 
         let isIconClick = event.originalTarget.getAttribute("anonid") == "searchbar-search-button";