How to use the same key for toggling widget visibility?

This issue seems to be easy but it really drives me nuts. The thing is, that it has to be able to be interrupted by a mouse click. The mouse click works. So this is what I’m trying to achieve:

  • press space to show the menu widget (works)
  • click on menu point to call an in-game action and then get back to viewport (works)

OR

  • get back to viewport by pressing space again without clicking a menu point (doesn’t work in combination)

I tried several ways, chiefly flow controls, but the second input from the space bar seems to be a real issue in the blueprint. It can’t just flipflop every time from status a) to status b) because there’s no way to predict the user’s interaction.

Is there somebody who knows ho to fix that? Thanks in advance!