diff --git a/src/common/game_settings.gd b/src/common/game_settings.gd index 6f2b66b..c56ff03 100644 --- a/src/common/game_settings.gd +++ b/src/common/game_settings.gd @@ -17,7 +17,7 @@ func _ready(): TranslationServer.set_locale(_state[_KEY_LOCALE]) func get_locale() -> String: - return _state[_KEY_LOCALE] + return _state.get(_KEY_LOCALE, TranslationServer.get_locale()) func set_locale(locale: String) -> void: _state[_KEY_LOCALE] = locale diff --git a/src/menus/options_menu.gd b/src/menus/options_menu.gd index dc4fae3..52c4efd 100644 --- a/src/menus/options_menu.gd +++ b/src/menus/options_menu.gd @@ -17,4 +17,9 @@ func _on_back_button_pressed() -> void: func _on_visibility_changed() -> void: if visible: - grab_focus() + # Defer one frame so the TabContainer is laid out and focusable before + # we call grab_focus on it. + await get_tree().process_frame + var tabs := find_child("TabContainer") + if tabs is Control: + (tabs as Control).grab_focus()