fx-compat: Fix position of collection and item context menus

This commit is contained in:
Dan Stillman 2022-05-04 05:45:37 -04:00
parent b49b8ad140
commit 1714351cc9
2 changed files with 12 additions and 10 deletions

View file

@ -577,7 +577,11 @@ class VirtualizedTable extends React.Component {
if (e.key == 'ContextMenu' || (e.key == 'F10' && e.shiftKey)) {
let selectedElem = document.querySelector(`#${this._jsWindowID} [aria-selected=true]`);
let boundingRect = selectedElem.getBoundingClientRect();
this.props.onItemContextMenu(e, boundingRect.left + 50, boundingRect.bottom);
this.props.onItemContextMenu(
e,
window.screenX + boundingRect.left + 50,
window.screenY + boundingRect.bottom
);
return;
}
@ -670,7 +674,7 @@ class VirtualizedTable extends React.Component {
if (!modifierClick && !this.selection.isSelected(index)) {
this._onSelection(index, false, false);
}
this.props.onItemContextMenu(e, e.clientX, e.clientY);
this.props.onItemContextMenu(e, window.screenX + e.clientX, window.screenY + e.clientY);
}
// All modifier clicks handled in mouseUp per mozilla itemtree convention
if (!modifierClick && !this.selection.isSelected(index)) {

View file

@ -2662,10 +2662,9 @@ var ZoteroPane = new function()
*/
this.onCollectionsContextMenuOpen = async function (event, x, y) {
await ZoteroPane.buildCollectionContextMenu();
x = x || event.clientX;
y = y || event.clientY;
document.getElementById('zotero-collectionmenu').openPopup(
null, null, x + 1, y + 1);
x = x || event.screenX;
y = y || event.screenY;
document.getElementById('zotero-collectionmenu').openPopupAtScreen(x + 1, y + 1, true);
};
@ -2674,10 +2673,9 @@ var ZoteroPane = new function()
*/
this.onItemsContextMenuOpen = async function (event, x, y) {
await ZoteroPane.buildItemContextMenu();
x = x || event.clientX;
y = y || event.clientY;
document.getElementById('zotero-itemmenu').openPopup(
null, null, x + 1, y + 1);
x = x || event.screenX;
y = y || event.screenY;
document.getElementById('zotero-itemmenu').openPopupAtScreen(x + 1, y + 1, true);
};