I'm trying to determine which node is receiving the focus in my scene. The Controls in my scene can be transversed with the keyboard arrows, as well as the cross directional pad on a controller. The thing is, I'm trying to narrow the focus to a handful of Controls ("play" button and "delete" button). So when the left or right arrows keys are pressed, buttons in my scene lose focus, yet I don't know where the focus is going.

I have tried messing around with the focus_mode property of several Control nodes. But that didn't change anything. I have also tried setting up the focus for the nearest neighbors, but that does nothing. The scene, BTW, adds entries to a ScrollContainer at runtime.

Parapixel from the Godot Discord server (in the UI channel) helped me to answer this question.

He suggested putting this code in my script:

func _ready() -> void:
    connect_focus_signal(get_tree().get_root())

func connect_focus_signal(node) -> void:
    if node is Control:
        node.connect("focus_entered", self, "_on_focus_entered")
    if node.get_child_count():
        for child in node.get_children():
            connect_focus_signal(child)

func _on_focus_entered() -> void:
    print("focus_entered %s" % get_focus_owner().name)

I was able to identify which node caused the issue.

a year later