How to set the neighbour bottom/top of an item in an Itemlist?

Godot Version



I have an Itemlist with generated amount of items and it can be navigated with the arrow keys. All works fine, but when you focus the last Item and press down, nothing happens. I want the list to go back to the first item when you press down on the last item. Also the other way around (first item → press up → last item focused).
It seems that cannot be set in the editor, there are only neighbours for the Itemlist itself, but not the items. Has anyone an idea how to solve this?

You have to code that yourself. Here’s a solution for the “Single” select mode:

func _on_gui_input(event: InputEvent) -> void:
	if not is_anything_selected():

	if event.is_action_pressed("ui_up"):
		select(wrapi(get_selected_items()[0]-1, 0, item_count))
	elif event.is_action_pressed("ui_down"):
		select(wrapi(get_selected_items()[0]+1, 0, item_count))

This connects the gui_input signal of the ItemList and assumes that the callback is located in a script that’s directly attached to it.