In Godot 3.0, I am trying to implement a PopupMenu
which allows scrolling through its buttons using the keyboard.
My scene structure is
PopupMenu
> ColorRect
> Button1
> Button2
Focus mode on the PopupMenu
is set to All
.
I have a very simple script on the PopupMenu
which attempts to assign focus to Button2
:
extends PopupMenu
func _ready():
get_node("Button2").grab_focus()
When I press escape, I call show()
on the popup and it is displayed, but neither of my buttons are focused on. So my question is: How can I set the focus on buttons in a PopupMenu and scroll through them with keyboard?
I noticed that if the buttons are children of a VBoxContainer
as the root node, it works as desired. But not if the VBoxContainer
is a child of the PopupMenu
.