I'm using this event handler in game scene, it checks if popup is_visible() and call things for various key presses:
func _input(event):
if event is InputEventKey and event.pressed:
if menu_popup.is_visible():
match event.scancode:
KEY_Q, KEY_ESCAPE:
menu_popup.hide()
KEY_1:
run_first_command()