I have multiple DOM elements with context menus. When one element is a child of the other and I invoke the context menu of the inner child, I also see the context menu from the parent. This is implemented with the jquery-ui.contextmenu plugin.
Is there a way to configure the plugin to prevent the parent's menu from being shown or am I going to have to handle all the click events manually and filter them so I show only the menu I want?
Following is my code:
HTML:
    <!-- Add a child which will have a context menu -->
    <div class="outer-child" id="outer-child">
        Outer Child
        <!-- inner child with its own context menu -->
        <div class="inner-child" id="inner-child">
            Inner Child
        </div>
    </div>
</div>
CSS:
.outer-child {
    position: absolute;
    top: 0px;
    left: 0px;
    width: 200px;
    height: 200px;
    border: 1px solid red;
    background: green;
}
.inner-child {
    position: absolute;
    top: 50px;
    left: 50px;
    width: 100px;
    height: 100px;
    border: 1px solid blue;
    background: yellow;
}
JavaScript:
// create context menu on outer child
$("#outer-child").contextmenu({
    menu: [
        {title: "This is the Outer Menu", cmd: "outer-menu"}
        ],
    select: function(event, ui) {
        alert("select " + ui.cmd + " on " + ui.target.text());
    }
});
// create context menu on inner child
$('#inner-child').contextmenu({
    menu: [
        {title: "Inner Menu", cmd: "inner-menu"}
        ],
    select: function(event, ui) {
        alert("select " + ui.cmd + " on " + ui.target.text());
    }
});
You can find a jsfiddle demo here. (Right-click the inner box and see both context menus)
 
    