fx-compat: Fix showNativeElementPopup() positioning on Win/Linux
This commit is contained in:
parent
8512402eca
commit
8f87a74398
1 changed files with 14 additions and 9 deletions
|
@ -2342,7 +2342,7 @@ Zotero.Utilities.Internal = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Open an element's <menupopup> child as a native context menu.
|
||||
* Open an element's <menupopup> child (as a native context menu on macOS).
|
||||
*
|
||||
* @param {XULElement} element
|
||||
* @return {Boolean} If a <menupopup> 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) => {
|
||||
|
|
Loading…
Reference in a new issue