diff --git a/chrome/content/zotero/xpcom/utilities_internal.js b/chrome/content/zotero/xpcom/utilities_internal.js index 4342058b44..1cc6e09c80 100644 --- a/chrome/content/zotero/xpcom/utilities_internal.js +++ b/chrome/content/zotero/xpcom/utilities_internal.js @@ -2342,7 +2342,7 @@ Zotero.Utilities.Internal = { }, /** - * Open an element's child as a native context menu. + * Open an element's child (as a native context menu on macOS). * * @param {XULElement} element * @return {Boolean} If a child was found and opened @@ -2350,14 +2350,19 @@ Zotero.Utilities.Internal = { showNativeElementPopup(element) { let popup = element.querySelector(':scope > menupopup'); if (popup) { - let rect = element.getBoundingClientRect(); - let win = element.ownerDocument.defaultView; - let dir = win.getComputedStyle(element).direction; - popup.openPopupAtScreen( - win.screenX + (dir == 'rtl' ? rect.right : rect.left), - win.screenY + rect.bottom, - true - ); + if (Zotero.isMac) { + let rect = element.getBoundingClientRect(); + let win = element.ownerDocument.defaultView; + let dir = win.getComputedStyle(element).direction; + popup.openPopupAtScreen( + win.screenX + (dir == 'rtl' ? rect.right : rect.left), + win.screenY + rect.bottom, + true + ); + } + else { + popup.openPopup(element, 'after_start', 0, 0, true, false); + } element.setAttribute('open', true); let handler = (event) => {