Fix main menu focus

This commit is contained in:
2026-06-12 22:21:42 -05:00
parent 27d056fafa
commit bfd455341d
3 changed files with 7 additions and 2 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ func _unhandled_input(event:InputEvent) -> void:
if event.is_action_pressed("menu"):
if visible:
close()
elif !UI.dialogueActive:
elif !UI.dialogueActive and SCENE.currentScene == SceneSingleton.SceneType.OVERWORLD:
open()
get_viewport().set_input_as_handled()
return
+4 -1
View File
@@ -12,7 +12,10 @@ func _ready() -> void:
btnQuit.pressed.connect(_onQuitPressed)
settingsMenu.opened.connect(_onSettingsOpened)
settingsMenu.closed.connect(_onSettingsClosed)
btnNewGame.grab_focus()
func _notification(what:int) -> void:
if what == NOTIFICATION_ENTER_TREE:
btnNewGame.call_deferred("grab_focus")
func _onSettingsOpened() -> void:
# Move focus into the settings panel so the controller can navigate it.
+2
View File
@@ -52,6 +52,8 @@ func onTabChanged(tabIndex:int) -> void:
_focusFirstIn(tabControls[tabIndex])
func _focusFirstIn(container:Control) -> void:
if !is_visible_in_tree():
return
for child in container.get_children():
if child is Control and child.focus_mode != Control.FOCUS_NONE:
child.grab_focus()