The default context menu behavior in ubuntu seems to be different from windows. Context menu event will be triggered in ubuntu before the mouse up event, while context menu event will be fired in windows after mouse up.
For example check the below sample in windows and ubuntu.
The node selection was made in the mouseup event in our diagram control. So when you first right-click the diagram, the context menu event triggered first and the diagram mouse up is triggered next. so it should be reversed in ubuntu.