Bug 1420749 - Allow browser.bookmarks.openInTabClosesMenu to work with containers as well as single menuitems
MozReview-Commit-ID: Bba3pLyHZUV
--- a/browser/base/content/browser-places.js
+++ b/browser/base/content/browser-places.js
@@ -776,18 +776,17 @@ var BookmarksEventHandler = {
// Handles left-click with modifier if not browser.bookmarks.openInTabClosesMenu.
if (aEvent.button != 0 || PlacesUIUtils.openInTabClosesMenu)
return;
let target = aEvent.originalTarget;
if (target.tagName != "menuitem")
return;
let modifKey = AppConstants.platform === "macosx" ? aEvent.metaKey
: aEvent.ctrlKey;
- // Don't keep menu open for 'Open all in Tabs'.
- if (modifKey && !target.classList.contains("openintabs-menuitem")) {
+ if (modifKey) {
target.setAttribute("closemenu", "none");
}
},
onClick: function BEH_onClick(aEvent, aView) {
// Only handle middle-click or left-click with modifiers.
let modifKey;
if (AppConstants.platform == "macosx") {
@@ -797,22 +796,21 @@ var BookmarksEventHandler = {
}
if (aEvent.button == 2 || (aEvent.button == 0 && !modifKey))
return;
var target = aEvent.originalTarget;
// If this event bubbled up from a menu or menuitem,
// close the menus if browser.bookmarks.openInTabClosesMenu.
- if ((PlacesUIUtils.openInTabClosesMenu && target.tagName == "menuitem") ||
- target.tagName == "menu" ||
- target.classList.contains("openintabs-menuitem")) {
+ var tag = target.tagName;
+ if (PlacesUIUtils.openInTabClosesMenu && (tag == "menuitem" || tag == "menu")) {
closeMenus(aEvent.target);
}
- // Command already precesssed so remove any closemenu attr set in onMouseUp.
+ // Command already processed so remove any closemenu attr set in onMouseUp.
if (aEvent.button == 0 &&
target.tagName == "menuitem" &&
target.getAttribute("closemenu") == "none") {
// On Mac we need to extend when we remove the flag, to avoid any pre-close
// animations.
setTimeout(() => {
target.removeAttribute("closemenu");
}, 500);