Quick answer: Godot 4 keyboard focus not returning to the previous control after a modal popup closes? Modal doesn't restore focus on close - explicitly call grab_focus on the original.

Inventory open with Tab navigation. Open settings popup; close; Tab no longer works.

Restore focus explicitly

var last = get_viewport().gui_get_focus_owner()
modal.popup_exclusive(self)
await modal.popup_hide
last.grab_focus()

Snapshot focus; restore after modal close.

Or use Popup.popup_exclusive_centered

Some popup variants handle focus restoration. Test which.

Verify focus on close

Print focus owner before/after popup. Mismatch = the restore didn't happen.

“Modals interrupt focus. Restoration is the caller's responsibility.”

Build a 'show modal' helper that handles focus capture/restore. Reusable; no per-call boilerplate.

Related reading