Added toggle fix for dropdown device menu
Added toggle fix for dropdown device menu

Summary:
Summary of Bug:

The devices menu popup does not toggle as expected.

Because of the way the click event is fired in Javascript, that is mousedown, mouseup, click, and the fact that the electron menu closes on mousedown, was why the menu was not toggling as expected.

Fix:

This is a potential fix where I add some state to tell if the menu was recently closed, and disable the popup if it was. This is done through the callback method of menu.popup. Then on the next mouse event I renable the popup.

In addition to this, I moved the popup logic into onMouseUp instead of onClick. This was simply to make the code neater. Before I would have to add a timer to the onMouseUp event that would fire after the click event and renable the popup.

Let me know if there is a simple solution to this problem that I've completely missed.

Reviewed By: jknoxville

Differential Revision: D16028864

fbshipit-source-id: a73202536762cce2ab623176cbda0369ca2b8079

facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper