diff --git a/chrome/content/zotero/elements/attachmentsBox.js b/chrome/content/zotero/elements/attachmentsBox.js
index 418d8fbf98..c6da991b1c 100644
--- a/chrome/content/zotero/elements/attachmentsBox.js
+++ b/chrome/content/zotero/elements/attachmentsBox.js
@@ -32,6 +32,7 @@
+
`);
_item = null;
@@ -83,6 +84,11 @@
this._section = this.querySelector('collapsible-section');
this._section.addEventListener('add', this._handleAdd);
this._body = this.querySelector('.body');
+
+ this._addPopup = document.getElementById('zotero-add-attachment-popup').cloneNode(true);
+ this._addPopup.id = '';
+ this.querySelector('popupset').append(this._addPopup);
+
this._notifierID = Zotero.Notifier.registerObserver(this, ['item'], 'attachmentsBox');
}
@@ -147,10 +153,10 @@
this._section.setCount(count);
}
- _handleAdd = () => {
- ZoteroPane.addAttachmentFromDialog(false, this._item.id);
- this._section.empty = false;
+ _handleAdd = (event) => {
this._section.open = true;
+ ZoteroPane.updateAddAttachmentMenu(this._addPopup);
+ this._addPopup.openPopup(event.detail.button, 'after_end');
};
_updateRowAttributes(row, attachment) {
diff --git a/chrome/content/zotero/elements/collapsibleSection.js b/chrome/content/zotero/elements/collapsibleSection.js
index ce9977720c..5a36ce33c9 100644
--- a/chrome/content/zotero/elements/collapsibleSection.js
+++ b/chrome/content/zotero/elements/collapsibleSection.js
@@ -261,7 +261,7 @@
}
_handleClick = (event) => {
- if (event.target.closest('.add')) return;
+ if (event.target.closest('.add, menupopup')) return;
this.open = !this.open;
};