Stop context menu click from propagating to items behind it

Using perspective 8.3.10.

I have a right-click context menu on a component, and one of the items in it runs a method which calls a popup. All fine, but when the popup opens, so does another one - because when I clicked the item on the context menu, behind it was an item which also has an onClick item to show a popup.

I understand that this is exactly what the "stop propagation" option is for on events, but this script is called by a custom method, and the custom method doesn't have that option.

How can I have the context menu block the click from passing through to whatever is behind it? I'd hate for the context menu just happen to be over a start button or a stop button or something and have an operator inadvertently start or stop something important.