How to stop ObjectContextClicked event propogation

Started with the flowchart.html sample.

Added this:

myDiagram.addDiagramListener(“ObjectContextClicked”,(e) => {
var mouseEvent: MouseEvent = e.diagram.lastInput.event;

        mouseEvent.cancelBubble = true;
        mouseEvent.stopPropagation();
        mouseEvent.preventDefault();
        e.cancel = true;
        return false;

});

Even with all of this, when I right click on a node, the default browser context menu displays.

I want to add some logic to this so that I can prevent the default browser context from displaying only in certain situations.

How can I accomplish this?

Is there a better even to attach to?

In what situation (browser, version, OS, version, hardware) are you getting a browser context menu? I thought it was disabled in all circumstances, so that you would not need to do what you are trying to do.

Only when I right click on a node in the development testbed I made.

When I do it on your example here I never get the browser context menu at all.

I figured it out. When I right click, this method gets triggered - which depending on some logic I am displaying a div over top of the canvas. Apparently, the div is what was receiving the context click. So I simply disable context clicking on that div and all is happy now.

Thanks :smile: