I've found a solution. Search about the Viewport class' "push_input" and the "push_text_input" methods. Here's a project I've found that uses this method gracefully. https://github.com/godotengine/godot-demo-projects/blob/master/viewport/gui_in_3d/gui_3d.gd line 46 at the time of writing.
push_input simply passes on the input from a parent viewport to a subviewport. Combining with "get_viewport().set_input_as_handled()" we can prevent unwanted player input. An example from my project (code was simplified):
func _input(event: InputEvent) -> void:
if not _locked_player: # Only register input if the player is sat at the computer terminal
return
if event.is_action_pressed(key_bind_escape): # Quit terminal if press Esc
_locked_player.MOVEMENT_COMPONENT.activate()
_locked_player.CAMERA_COMPONENT.activate()
_locked_player.CAMERA_COMPONENT.reset_fov()
_locked_player = null
# this method calls release_focus on all child control nodes. SCREEN is within the subviewport
SCREEN.remove_focus()
# Consume the input
# (since it's a FPS game, ESC also frees the mouse. We can prevent this by calling this method)
get_viewport().set_input_as_handled()
return
$SubViewport.push_input(event)
get_viewport().set_input_as_handled()
I hope this answer is useful. Just made this account to share this info. Please share this in other forums as well, it seems very people know about this.