[JENKINS-17050] Close pop-up menu when clicking outside.

The _activationButtonPressed get's set to false onMouseUp, so can not be used to decide if the menu is active or not.

Rebased, and squashed, as the previous pull request (https://github.com/jenkinsci/jenkins/pull/1038) was erroneously marked as merged.