summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2023-11-11 17:10:04 +0100
committerMoonchild <moonchild@palemoon.org>2023-11-11 17:22:06 +0100
commit30b19d3ebaff7d7a91c130f910cf63e335dfce37 (patch)
treecce9324605b477532a45e7bcb4be476c6343dc36
parentd858ff342bddad365d4580670069afcc2d82569c (diff)
downloadpalemoon-release.tar.gz
Revert "Issue #1936 - Optionally leave Bookmarks menu open when spawning new tab."release
This reverts commit 72d882780643d2f11717525e342febe866b18880.
-rw-r--r--palemoon/app/profile/palemoon.js3
-rw-r--r--palemoon/base/content/browser-menubar.inc1
-rw-r--r--palemoon/base/content/browser-places.js61
-rw-r--r--palemoon/base/content/browser.xul2
-rw-r--r--palemoon/components/places/content/placesOverlay.xul4
5 files changed, 14 insertions, 57 deletions
diff --git a/palemoon/app/profile/palemoon.js b/palemoon/app/profile/palemoon.js
index f65574fe7..5c01dc59d 100644
--- a/palemoon/app/profile/palemoon.js
+++ b/palemoon/app/profile/palemoon.js
@@ -504,9 +504,6 @@ pref("browser.bookmarks.autoExportHTML", false);
// 0: no backups created (and deletes all existing backups)
pref("browser.bookmarks.max_backups", 10);
-// Whether menu should close after Ctrl-click, middle-click, etc.
-pref("browser.bookmarks.openInTabClosesMenu", true);
-
// Scripts & Windows prefs
pref("dom.disable_open_during_load", true);
pref("javascript.options.showInConsole", true);
diff --git a/palemoon/base/content/browser-menubar.inc b/palemoon/base/content/browser-menubar.inc
index d0a84dffd..8651d07bf 100644
--- a/palemoon/base/content/browser-menubar.inc
+++ b/palemoon/base/content/browser-menubar.inc
@@ -419,7 +419,6 @@
#endif
context="placesContext"
openInTabs="children"
- onmouseup="BookmarksEventHandler.onMouseUp(event);"
oncommand="BookmarksEventHandler.onCommand(event, this.parentNode._placesView);"
onclick="BookmarksEventHandler.onClick(event, this.parentNode._placesView);"
onpopupshowing="PlacesCommandHook.updateBookmarkAllTabsCommand();
diff --git a/palemoon/base/content/browser-places.js b/palemoon/base/content/browser-places.js
index 3162e21eb..431be30cb 100644
--- a/palemoon/base/content/browser-places.js
+++ b/palemoon/base/content/browser-places.js
@@ -767,46 +767,17 @@ HistoryMenu.prototype = {
* Functions for handling events in the Bookmarks Toolbar and menu.
*/
var BookmarksEventHandler = {
-
- /**
- * Handler for mouseUp event for an item in the bookmarks toolbar or menu.
- * When items are middle-clicked (or clicked with modifier), check if the
- * menu should remain open.
- * @param aEvent
- * DOMEvent for the click
- */
-
- onMouseUp(aEvent) {
- // Handles left-click with modifier if not browser.bookmarks.openInTabClosesMenu.
- if (aEvent.button != 0 ||
- Services.prefs.getBoolPref("browser.bookmarks.openInTabClosesMenu", true))
- return;
- let target = aEvent.originalTarget;
- if (target.tagName != "menuitem")
- return;
-#ifdef XP_MACOSX
- var modifKey = aEvent.metaKey;
-#else
- var modifKey = aEvent.ctrlKey;
-#endif
- // Don't keep menu open for 'Open all in Tabs'.
- if (modifKey && !target.classList.contains("openintabs-menuitem")) {
- target.setAttribute("closemenu", "none");
- }
- },
-
/**
* Handler for click event for an item in the bookmarks toolbar or menu.
* Menus and submenus from the folder buttons bubble up to this handler.
* Left-click is handled in the onCommand function.
* When items are middle-clicked (or clicked with modifier), open in tabs.
- * If the click came through a menu, close the menu unless preffed otherwise.
+ * If the click came through a menu, close the menu.
* @param aEvent
* DOMEvent for the click
* @param aView
* The places view which aEvent should be associated with.
*/
-
onClick: function(aEvent, aView) {
// Only handle middle-click or left-click with modifiers.
#ifdef XP_MACOSX
@@ -819,23 +790,19 @@ var BookmarksEventHandler = {
}
var target = aEvent.originalTarget;
- // If this event bubbled up from a menu or menuitem,
- // close the menus if browser.bookmarks.openInTabClosesMenu.
- if ((Services.prefs.getBoolPref("browser.bookmarks.openInTabClosesMenu", true) &&
- target.tagName == "menuitem") ||
- target.tagName == "menu" ||
- target.classList.contains("openintabs-menuitem")) {
- closeMenus(aEvent.target);
- }
- // Command already precesssed 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);
+ // If this event bubbled up from a menu or menuitem, close the menus.
+ // Do this before opening tabs, to avoid hiding the open tabs confirm-dialog.
+ if (target.localName == "menu" || target.localName == "menuitem") {
+ for (node = target.parentNode; node; node = node.parentNode) {
+ if (node.localName == "menupopup") {
+ node.hidePopup();
+ } else if (node.localName != "menu" &&
+ node.localName != "splitmenu" &&
+ node.localName != "hbox" &&
+ node.localName != "vbox" ) {
+ break;
+ }
+ }
}
if (target._placesNode && PlacesUtils.nodeIsContainer(target._placesNode)) {
diff --git a/palemoon/base/content/browser.xul b/palemoon/base/content/browser.xul
index 75d22eeb8..c628bd7a5 100644
--- a/palemoon/base/content/browser.xul
+++ b/palemoon/base/content/browser.xul
@@ -566,7 +566,6 @@
placespopup="true"
context="placesContext"
openInTabs="children"
- onmouseup="BookmarksEventHandler.onMouseUp(event);"
oncommand="BookmarksEventHandler.onCommand(event, this.parentNode._placesView);"
onclick="event.stopPropagation();
BookmarksEventHandler.onClick(event, this.parentNode._placesView);"
@@ -735,7 +734,6 @@
<hbox flex="1"
id="PlacesToolbar"
context="placesContext"
- onmouseup="BookmarksEventHandler.onMouseUp(event);"
onclick="BookmarksEventHandler.onClick(event, this._placesView);"
oncommand="BookmarksEventHandler.onCommand(event, this._placesView);"
tooltip="bhTooltip"
diff --git a/palemoon/components/places/content/placesOverlay.xul b/palemoon/components/places/content/placesOverlay.xul
index a2ba868af..59115a57f 100644
--- a/palemoon/components/places/content/placesOverlay.xul
+++ b/palemoon/components/places/content/placesOverlay.xul
@@ -100,10 +100,6 @@
<menupopup id="placesContext"
onpopupshowing="this._view = PlacesUIUtils.getViewForNode(document.popupNode);
- if (!PlacesUIUtils.openInTabClosesMenu) {
- document.getElementById ('placesContext_open:newtab')
- .setAttribute('closemenu', 'single');
- }
return this._view.buildContextMenu(this);"
onpopuphiding="this._view.destroyContextMenu();">
<menuitem id="placesContext_open"