Bug 1388832 - Fix right-click on searchbar when in overflow menu. r=jaws
☠☠ backed out by f39c3b2da2d1 ☠ ☠
authorSam Foster <sfoster@mozilla.com>
Tue, 19 Sep 2017 15:40:56 -0700
changeset 431568 6de16b8f63dcd2667b307ccb9d2c44783fb646f4
parent 431550 fc0e284fb21bbb2524a16f60a04a806d3b905d1f
child 431569 c9bfc364426e39047b46dea407839ff3b75c7897
push id7785
push userryanvm@gmail.com
push dateThu, 21 Sep 2017 13:39:55 +0000
treeherdermozilla-beta@06d4034a8a03 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1388832
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1388832 - Fix right-click on searchbar when in overflow menu. r=jaws * Swap margins for paddings around the searchbar when in a menu. Elements that could precede and follow the searchbar all have margin: 0, and define top/bottom padding as 4px, so this seems reasonable * Replace the loop that looks for an appropriate trigger node to use element.closest. A click on the outside a toolbarbutton/item was climbing to the document node and throwing as it has no getAttribute method. MozReview-Commit-ID: LuniL3gdLWR
browser/base/content/browser.js
browser/themes/shared/customizableui/panelUI.inc.css
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -5423,25 +5423,18 @@ function onViewToolbarsPopupShowing(aEve
   }
 
   // triggerNode can be a nested child element of a toolbaritem.
   let toolbarItem = popup.triggerNode;
 
   if (toolbarItem && toolbarItem.localName == "toolbarpaletteitem") {
     toolbarItem = toolbarItem.firstChild;
   } else if (toolbarItem && toolbarItem.localName != "toolbar") {
-    while (toolbarItem && toolbarItem.parentNode) {
-      let parent = toolbarItem.parentNode;
-      if ((parent.classList && parent.classList.contains("customization-target")) ||
-          parent.getAttribute("overflowfortoolbar") || // Needs to work in the overflow list as well.
-          parent.localName == "toolbarpaletteitem" ||
-          parent.localName == "toolbar")
-        break;
-      toolbarItem = parent;
-    }
+    toolbarItem = toolbarItem.closest(
+      ".customization-target, [overflowfortoolbar], toolbarpaletteitem, toolbar");
   } else {
     toolbarItem = null;
   }
 
   let showTabStripItems = toolbarItem && toolbarItem.id == "tabbrowser-tabs";
   for (let node of popup.querySelectorAll('menuitem[contexttype="toolbaritem"]')) {
     node.hidden = showTabStripItems;
   }
--- a/browser/themes/shared/customizableui/panelUI.inc.css
+++ b/browser/themes/shared/customizableui/panelUI.inc.css
@@ -1617,18 +1617,18 @@ toolbarpaletteitem[place="palette"] > .t
 #bookmarks-menu-button[cui-areatype="menu-panel"] > .toolbarbutton-menu-dropmarker,
 #bookmarks-menu-button[overflowedItem] > .toolbarbutton-menu-dropmarker,
 toolbarpaletteitem[place="palette"] > .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker,
 #bookmarks-menu-button[cui-areatype="menu-panel"] > .toolbarbutton-menubutton-dropmarker {
   display: none;
 }
 
 #search-container[cui-areatype="menu-panel"] {
-  margin-top: 6px;
-  margin-bottom: 6px;
+  padding-top: 6px;
+  padding-bottom: 6px;
 }
 
 toolbarpaletteitem[place="palette"] > #search-container {
   min-width: 7em;
   width: 7em;
   min-height: 37px;
 }