Repository: godot
Issue: (Code-Shown) Popup Menu Makes Ordinary Menu Items Unresponsive
Labels: bug,confirmed,topic:gui

> [!IMPORTANT]
> ***Bugsquad note:** This issue has been confirmed several times already. No need to confirm it further.* 

### Tested versions

v4.2.1.stable.official [b09f793f5]
(The issue DO NOT exit on v3.5.2)

### System information

Windows 11 Pro - Godot_v4.2.1-stable_win64.exe

### Issue description

In Godot v4.2: when summoning a popup and subsequently close it (either by clicking outside, or calling `hide()`), it will cause all other popups and certain GUI hover event stop working (e.g. it causes it not possible to resize a `GraphNode` if using a `GraphEdit`). This issue notably blocks input not just on MenuBar, but also on MenuButton (I suppose it's because they all uses popup window behind the scene). However, if one attempts to summon the popup at the same time performing a typical mouse button click on any menu bar item, the problem goes away; The problem can also be "fixed" if one  switches the window (e.g. on Windows, use `Alt-Tab`), i.e. defocusing then focusing again the Godot application window.

Please see video below for a demo:

https://github.com/godotengine/godot/assets/7077098/b5bac962-a81e-4b08-ad41-928d917ed39f

I CAN CONFIRM THE ISSUE DOES NOT EXIST ON GODOT Godot_v3.5.3-stable_mono_win64, which doesn't have a MenuBar so I tested with MenuButton. Setups for both Godot 4.2 and Godot 3.5 including both MenuBar, MenuButton and PopupMenu are available at the end of this description.

### Steps to reproduce

Setup:
1. Create a blank project
2. Add a MenuBar at top level, add a child PopupMenu (This is unique per Godot 4.2)
3. Add a MenuButton at top level (This is for parallel comparison with Godot 3.5)
4. Add a PopupMenu at top level (we will summon this in script)
5. Create script to summon the popup menu on RMB

Reproduce issue:
1. Start the game
2. Click MenuBar or MenuButton, the popup works correctly
3. Summon the PopupMenu by RMB on canvas area
4. The PopupMenu shows correctly, now close it by clicking somewhere in empty space
5. Now try to click MenuBar or MenuButton - nothing will happen
6. (Same issue happens if instead of closing the PopupMenu by clicking somewhere else, we call `hide()` in script, e.g. through a key-binding; This is not shown in the video above or setup projects below)

Workaround:
1. Switch window focus, e.g. go to other application then come back to Godot
2. Try clicking MenuBar or MenuButton, it works again
3. Replicate the issue, then try RMB on a MenuBar or MenuButton, which will cause TWO pops to show (one for the popup menu itself due to script summoning it, the other is for the MenuButton itself from editor/inspector setup). Close those popups, then clicking on MenuBar or MenuButton, it works.

### Minimal reproduction project (MRP)

The project that shows the issue for Godot 4.2: https://github.com/Charles-Zhang-Bug-Reports/Godot_4_2_Popup_Issue  
(Notably: https://github.com/Charles-Zhang-Bug-Reports/Godot_4_2_Popup_Issue/commit/b6f3360eaa06f7b0373b9bdda8e3c1fcc960be11)

The project that shows the same issue does not exist for Godot 3.5: https://github.com/Charles-Zhang-Bug-Reports/Godot_3_5_3_No_Popup_Issue
(Notably: https://github.com/Charles-Zhang-Bug-Reports/Godot_3_5_3_No_Popup_Issue/commit/570fb2f2deb3976744edac32fee8d2ef03f64f33)