feat: make it so opening context menu on an element isn't overridden by another context menu listener on an ancestor of that element

This commit is contained in:
SauceyRed 2025-08-07 08:59:20 +02:00
parent fdfffd78e7
commit 86af8145b4
Signed by: sauceyred
GPG key ID: 2BF92EB6D8A5CCA7

View file

@ -3,10 +3,15 @@ import ContextMenu from "~/components/UserInterface/ContextMenu.vue";
import type { ContextMenuInterface, ContextMenuItem } from "~/types/interfaces";
export default (e: MouseEvent | PointerEvent, contextMenu: ContextMenuInterface, menuItems: ContextMenuItem[]) => {
console.log("Showing context menu");
contextMenu.show = true;
contextMenu.pointerX = e.clientX;
contextMenu.pointerY = e.clientY;
contextMenu.items = menuItems;
console.log("Showed");
e.preventDefault();
e.stopPropagation();
console.log("Menu items:", menuItems);
if (menuItems.length) {
console.log("Showing context menu");
contextMenu.show = true;
contextMenu.pointerX = e.clientX;
contextMenu.pointerY = e.clientY;
contextMenu.items = menuItems;
console.log("Showed");
}
}