diff --git a/browser/base/content/browser-places.js b/browser/base/content/browser-places.js index 3c0087fb4318..d162c815f4e6 100644 --- a/browser/base/content/browser-places.js +++ b/browser/base/content/browser-places.js @@ -999,7 +999,7 @@ let BookmarkingUI = { if (widget.overflowed) { // Don't open a popup in the overflow popup, rather just open the Library. event.preventDefault(); - widget.node.removeAttribute("noautoclose"); + widget.node.removeAttribute("closemenu"); PlacesCommandHook.showPlacesOrganizer("BookmarksMenu"); return; } @@ -1172,7 +1172,7 @@ let BookmarkingUI = { let view = document.getElementById("PanelUI-bookmarks"); view.addEventListener("ViewShowing", this.onPanelMenuViewShowing); view.addEventListener("ViewHiding", this.onPanelMenuViewHiding); - widget.node.setAttribute("noautoclose", "true"); + widget.node.setAttribute("closemenu", "none"); PanelUI.showSubView("PanelUI-bookmarks", widget.node, CustomizableUI.AREA_PANEL); return; @@ -1181,9 +1181,9 @@ let BookmarkingUI = { // Allow to close the panel if the page is already bookmarked, cause // we are going to open the edit bookmark panel. if (this._itemIds.length > 0) - widget.node.removeAttribute("noautoclose"); + widget.node.removeAttribute("closemenu"); else - widget.node.setAttribute("noautoclose", "true"); + widget.node.setAttribute("closemenu", "none"); } // Ignore clicks on the star if we are updating its state. diff --git a/browser/base/content/browser-social.js b/browser/base/content/browser-social.js index 49213069d60c..700f2e91f19b 100644 --- a/browser/base/content/browser-social.js +++ b/browser/base/content/browser-social.js @@ -1171,7 +1171,7 @@ SocialStatus = { if (inMenuPanel) { panel = document.getElementById("PanelUI-socialapi"); this._attachNotificatonPanel(panel, aToolbarButton, provider); - widget.node.setAttribute("noautoclose", "true"); + widget.node.setAttribute("closemenu", "none"); showingEvent = "ViewShowing"; hidingEvent = "ViewHiding"; } else { diff --git a/browser/base/content/socialmarks.xml b/browser/base/content/socialmarks.xml index 3a059aebab4c..28d67c6ccd5e 100644 --- a/browser/base/content/socialmarks.xml +++ b/browser/base/content/socialmarks.xml @@ -23,7 +23,7 @@ let widget = widgetGroup.forWindow(window); this.inMenuPanel = widgetGroup.areaType == CustomizableUI.TYPE_MENU_PANEL; if (this.inMenuPanel) { - widget.node.setAttribute("noautoclose", "true"); + widget.node.setAttribute("closemenu", "none"); return document.getElementById("PanelUI-socialapi"); } return document.getAnonymousElementByAttribute(this, "anonid", "panel"); diff --git a/browser/components/customizableui/content/panelUI.js b/browser/components/customizableui/content/panelUI.js index 70f020e86d1f..76d231fd58a0 100644 --- a/browser/components/customizableui/content/panelUI.js +++ b/browser/components/customizableui/content/panelUI.js @@ -330,9 +330,15 @@ const PanelUI = { * so that the panel knows if and when to close itself. */ onCommandHandler: function(aEvent) { - if (!aEvent.originalTarget.hasAttribute("noautoclose")) { - PanelUI.hide(); + let closemenu = aEvent.originalTarget.getAttribute("closemenu"); + if (closemenu == "none") { + return; } + if (closemenu == "single") { + this.showMainView(); + return; + } + this.hide(); }, /** diff --git a/browser/components/customizableui/src/CustomizableUI.jsm b/browser/components/customizableui/src/CustomizableUI.jsm index 4c9884850d6b..4ea11d1430b6 100644 --- a/browser/components/customizableui/src/CustomizableUI.jsm +++ b/browser/components/customizableui/src/CustomizableUI.jsm @@ -1230,7 +1230,8 @@ let CustomizableUIInternal = { } // If the user hit enter/return, we don't check preventDefault - it makes sense // that this was prevented, but we probably still want to close the panel. - // If consumers don't want this to happen, they should specify noautoclose. + // If consumers don't want this to happen, they should specify the closemenu + // attribute. } else if (aEvent.type != "command") { // mouse events: if (aEvent.defaultPrevented || aEvent.button != 0) { @@ -1243,7 +1244,7 @@ let CustomizableUIInternal = { } } - if (aEvent.target.getAttribute("noautoclose") == "true" || + if (aEvent.target.getAttribute("closemenu") == "none" || aEvent.target.getAttribute("widget-type") == "view") { return; } diff --git a/browser/components/customizableui/src/CustomizableWidgets.jsm b/browser/components/customizableui/src/CustomizableWidgets.jsm index 8a0b720dd6a8..641262dcd7fc 100644 --- a/browser/components/customizableui/src/CustomizableWidgets.jsm +++ b/browser/components/customizableui/src/CustomizableWidgets.jsm @@ -44,12 +44,12 @@ function setAttributes(aNode, aAttrs) { } } -function updateCombinedWidgetStyle(aNode, aArea, aModifyAutoclose) { +function updateCombinedWidgetStyle(aNode, aArea, aModifyCloseMenu) { let inPanel = (aArea == CustomizableUI.AREA_PANEL); let cls = inPanel ? "panel-combined-button" : "toolbarbutton-1"; let attrs = {class: cls}; - if (aModifyAutoclose) { - attrs.noautoclose = inPanel ? true : null; + if (aModifyCloseMenu) { + attrs.closemenu = inPanel ? "none" : null; } for (let i = 0, l = aNode.childNodes.length; i < l; ++i) { if (aNode.childNodes[i].localName == "separator") @@ -311,7 +311,7 @@ const CustomizableWidgets = [{ let areaType = CustomizableUI.getAreaType(this.currentArea); let inPanel = areaType == CustomizableUI.TYPE_MENU_PANEL; let inToolbar = areaType == CustomizableUI.TYPE_TOOLBAR; - let noautoclose = inPanel ? "true" : null; + let closeMenu = inPanel ? "none" : null; let cls = inPanel ? "panel-combined-button" : "toolbarbutton-1"; if (!this.currentArea) @@ -319,20 +319,20 @@ const CustomizableWidgets = [{ let buttons = [{ id: "zoom-out-button", - noautoclose: noautoclose, + closemenu: closeMenu, command: "cmd_fullZoomReduce", class: cls, label: true, tooltiptext: true }, { id: "zoom-reset-button", - noautoclose: noautoclose, + closemenu: closeMenu, command: "cmd_fullZoomReset", class: cls, tooltiptext: true }, { id: "zoom-in-button", - noautoclose: noautoclose, + closemenu: closeMenu, command: "cmd_fullZoomEnlarge", class: cls, label: true,