How to add focus to generated UI Elements?

Godot Version

4.2.2

Question

So my game has multiple characters, and I have created a character info screen. When this screen loads, it generates a VBoxContainer for each character from an AutoLoad, and in that container it displays the Sprite and the Name of the character. I had set them up so when they are clicked, it loads that characters information page. I am now trying to add controller UI support to my game, and have gotten every other menu to work just fine, and now this character info page is kicking my ass.

func load_character_data():
	var first_character_set = false
	for character in CharacterManager.characters:
		
		var character_box = VBoxContainer.new()
		
		var sprite = TextureRect.new()
		sprite.texture = character["sprite"]
		sprite.expand = true
		sprite.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
		sprite.custom_minimum_size = Vector2(100, 100)  # Adjust size as needed
		
		var name_label = Label.new()
		name_label.text = character["name"]
		name_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
		
		character_box.add_child(sprite)
		character_box.add_child(name_label)
		
		# Make both sprite and name clickable
		sprite.mouse_filter = Control.MOUSE_FILTER_STOP
		name_label.mouse_filter = Control.MOUSE_FILTER_STOP
		
		# Connect click events
		sprite.gui_input.connect(_on_character_clicked.bind(self, character))
		name_label.gui_input.connect(_on_character_clicked.bind(self, character))
		
		character_box.focus_mode = Control.FOCUS_ALL
		
		# Add a focus indicator
		var focus_indicator = ColorRect.new()
		focus_indicator.color = Color(1, 1, 1, 0.5)  # Semi-transparent white
		focus_indicator.set_size(Vector2(5120, 5120))  # Adjust size as needed
		focus_indicator.visible = false  # Start hidden
		sprite.add_child(focus_indicator)
		
		# Connect focus events to show/hide the focus indicator
		sprite.connect("focus_entered", Callable(self, "_on_focus_entered"))
		sprite.connect("focus_exited", Callable(self, "_on_focus_exited"))
		
		character_container.add_child(character_box)
		if not first_character_set:
			character_box.grab_focus()
			first_character_set = true
			print("First character box focused:", character["name"])

		# Ensure the parent container can pass focus
		character_container.focus_mode = Control.FOCUS_ALL

func _on_focus_entered():
	var focus_owner = get_viewport().gui_get_focus_owner()
	if focus_owner:
		var focus_indicator = focus_owner.get_meta("focus_indicator")
		if focus_indicator:
			focus_indicator.visible = true

func _on_focus_exited():
	var focus_owner = get_viewport().gui_get_focus_owner()
	if focus_owner:
		var focus_indicator = focus_owner.get_meta("focus_indicator")
		if focus_indicator:
			focus_indicator.visible = false

func _unhandled_input(event: InputEvent):
	if event.is_action_pressed("ui_accept"):
		var focused = get_viewport().gui_get_focus_owner()
		if focused and focused is VBoxContainer:
			var character = focused.get_meta("character_data")
			if character:
				open_character_details(character)

I both do not see any indicator that any elements are focused, nor does pressing the ui_accept button do anything on any of the characters, although both seem to work on the buttons that aren’t generated.

At first I was trying to get the UI focus to work on the VBoxContainers but figured that might not be a thing. Now I’m not sure what to do. Any thoughts?