property generatedByKeyboard

(r/o) bool generatedByKeyboard;

Typ

Zugriff

This property returns true if the context menu was popped due to keyboard interaction. (by pressing the application key or Shift + F10 keys). Otherwise it is false (for example, when popping a context menu by clicking right mouse button).
<button context="myContext"/>
<menuPopup id="myContext">
    <menuItem label="item1"/>
</menuPopup>

var eventObj = shell.currentEvent;
var isGeneratedByKeyboard = eventObj.generatedByKeyboard;
if (isGeneratedByKeyboard)
{
    // we are trying to pop context menu with keyboard
}
else
{
    // we are trying to pop context menu with mouse
}