mirror of
https://github.com/Azornes/Comfyui-LayerForge.git
synced 2026-03-24 14:02:11 -03:00
Prevent browser context menu on custom right-click menus
Always prevent the default browser context menu and stop event propagation on right-click interactions and custom menus. This ensures that only the application's custom context menus are shown and avoids interference from the browser's native context menu.
This commit is contained in:
@@ -739,6 +739,12 @@ export class CanvasLayers {
|
||||
content.appendChild(container);
|
||||
});
|
||||
|
||||
// Add contextmenu event listener to the menu itself to prevent browser context menu
|
||||
menu.addEventListener('contextmenu', (e: MouseEvent) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
const container = this.canvas.canvas.parentElement || document.body;
|
||||
container.appendChild(menu);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user