diff --git a/chrome/content/zotero/elements/menuToolbarbutton.js b/chrome/content/zotero/elements/menuToolbarbutton.js
index a419257669..4f8b7b2307 100644
--- a/chrome/content/zotero/elements/menuToolbarbutton.js
+++ b/chrome/content/zotero/elements/menuToolbarbutton.js
@@ -33,26 +33,9 @@
constructor() {
super();
this.addEventListener('mousedown', (event) => {
- let popup = this.querySelector(':scope > menupopup');
- if (popup && this.getAttribute('nonnativepopup') != 'true') {
+ if (this.getAttribute('nonnativepopup') != 'true'
+ && Zotero.Utilities.Internal.showNativeElementPopup(this)) {
event.preventDefault();
-
- let rect = this.getBoundingClientRect();
- let dir = getComputedStyle(this).direction;
- popup.openPopupAtScreen(
- window.screenX + (dir == 'rtl' ? rect.right : rect.left),
- window.screenY + rect.bottom,
- true
- );
- this.setAttribute('open', true);
-
- let handler = (event) => {
- if (event.target == popup) {
- this.setAttribute('open', false);
- popup.removeEventListener('popuphiding', handler);
- }
- };
- popup.addEventListener('popuphiding', handler);
}
});
}
diff --git a/chrome/content/zotero/elements/splitMenuButton.js b/chrome/content/zotero/elements/splitMenuButton.js
new file mode 100644
index 0000000000..1159d9db3e
--- /dev/null
+++ b/chrome/content/zotero/elements/splitMenuButton.js
@@ -0,0 +1,95 @@
+/*
+ ***** BEGIN LICENSE BLOCK *****
+
+ Copyright © 2022 Corporation for Digital Scholarship
+ Vienna, Virginia, USA
+ https://www.zotero.org
+
+ This file is part of Zotero.
+
+ Zotero is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Zotero is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with Zotero. If not, see .
+
+ ***** END LICENSE BLOCK *****
+*/
+
+"use strict";
+
+{
+ /**
+ * Extends MozButton to provide a split menubutton with a clickable left side and a dropmarker that opens a menu.
+ */
+ class SplitMenuButton extends customElements.get('button') {
+ constructor() {
+ super();
+
+ // Just in case, make sure this button does NOT appear as a standard