Programmatically close context menu

As per your suggestion, customized the CommandContextMenuTool example onKeyDown to provide menu keyboard navigation. Up/Down can now scroll the menu and Enter can even perform the click action. So far so good.

The problem comes when trying to close the menu either after an action (Enter) or just Escape.

I have tried:

  • hideContextMenu();
  • doStop();
  • this.cancelWaitAfter(); doStop(); that seems to be what is happening with click outside of menu area.

I have tried with opening the menu via the keyboard or the normal mouse open.

Whenever I try to close the menu, the menu goes away but the diagram canvas stops responding to any input, mouse or keyboard. I can still go elsewhere or tab to a different location but I have to close the diagram, have not been able to do anything afterwards.

Help please as this is a showstopper.
Alain

Went searching again and found this post: Show/Hide context menu for node - #8 by walter and applied the solution there and it is now working.

Maybe a documentation update would benefit everyone here.