From 6db6fbba7f8ce8b19418b0969950ecd4091f5bad Mon Sep 17 00:00:00 2001 From: Voyager Date: Sun, 16 Aug 2026 12:26:41 -0400 Subject: [PATCH] fix: clarify controller room browser focus --- ...ontroller_menu_accessibility_validation.gd | 23 ++++++++++ ui/controller_focus_presentation.gd | 2 +- ui/icons/pictograms/arrow_cursor.png | Bin 0 -> 658 bytes ui/icons/pictograms/arrow_cursor.png.import | 40 ++++++++++++++++++ ui/network/join_game_page.gd | 20 ++++++--- 5 files changed, 79 insertions(+), 6 deletions(-) create mode 100644 ui/icons/pictograms/arrow_cursor.png create mode 100644 ui/icons/pictograms/arrow_cursor.png.import diff --git a/tests/controller_menu_accessibility_validation.gd b/tests/controller_menu_accessibility_validation.gd index 702210b..71c9cd4 100644 --- a/tests/controller_menu_accessibility_validation.gd +++ b/tests/controller_menu_accessibility_validation.gd @@ -104,6 +104,29 @@ func _validate_join_game_navigation() -> void: var discover_controls: Array[Control] = modes.duplicate() discover_controls.append_array([server_list, refresh, join, back]) _assert_directionally_reachable(discover, discover_controls) + var rooms: Array[Dictionary] = [ + { + "room_id": "controller-default-room", + "room_name": "Controller default room", + "current_players": 1, + "max_players": 8, + }, + { + "room_id": "controller-second-room", + "room_name": "Controller second room", + "current_players": 2, + "max_players": 8, + }, + ] + page.call("_on_discovery_rooms_updated", rooms) + _expect( + int(page.get("_selected_discovery_index")) == 0, + "Discovery should select its first room as soon as results arrive.", + ) + _expect( + server_list.is_selected(0), + "Discovery's visible cursor and selected room should agree immediately.", + ) address.show() address.editable = true diff --git a/ui/controller_focus_presentation.gd b/ui/controller_focus_presentation.gd index 5399893..04b259f 100644 --- a/ui/controller_focus_presentation.gd +++ b/ui/controller_focus_presentation.gd @@ -3,7 +3,7 @@ extends Node const CONTROLLER_MOTION_THRESHOLD: float = 0.35 const FOCUS_ARROW_TEXTURE: Texture2D = preload( - "res://ui/icons/pictograms/arrow_light_up_full.png" + "res://ui/icons/pictograms/arrow_cursor.png" ) const FOCUS_ARROW_SIZE: Vector2 = Vector2(32.0, 32.0) const FOCUS_ARROW_ROTATION_DEGREES: float = 150.0 diff --git a/ui/icons/pictograms/arrow_cursor.png b/ui/icons/pictograms/arrow_cursor.png new file mode 100644 index 0000000000000000000000000000000000000000..0ea6e395c805bddbe7a94e4cde17e1e56e469527 GIT binary patch literal 658 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I3?%1nZ+ru!7>k44ofvPP)Tsw@SkfJR9T^xl z_H+M9WCijSl0AZa85pY67#JE_7#My5g&JNkFq9fFFuY1&V6d9Oz#v{QXIG#NP@*xw zC&U#<1Hs|@&%o&Uq5DsPj3Xc}hyg*zfQ$zq!P~e0A9?Wn$c;xwo;^GA;Mv}LAQGhh z!Lu{Zo*laP^blC(;d{>xKYVfc{`12Rfr4N|z*0x=J_jlWS^-oK6bC8>S{=M)wLFkw zED7=pW^j0RBMr#mEbxddW?;}$24TjErS@e&LG}_)Usv{590CIT^1N4U0)Tq_JY5_^ zA`ZWuevt350!Q2GlX4Bp+xPwt&Wo^aT%?qClJD_`C7u7peSo&1Ed zuZc{aj0!#)Rc8{NE~ayFFiv7w(#w+6a`^z40|(P5(G5Ntd&cV#Y z;yi!)GtcMyy$pmSGF<)N=eowf*EwX?u>H_ic|PG^ztT4=w(@*9d-()|zu;vSwU&*I zpVNMQX|9|lZJ@T}t8G*K{LNRrmowfKxg>Pp#Z%w@1M`kHdtP9hVlC=&YSKctsQXOM zH+V3_Ug=Q`5?JoPkujk89LF02lbxIzm3QJMzLk1b#A{*V#4Io~=4RA+GZrQP#y+K{ zI~_U<>3amHb6-u^8c@n0&$6|JIq!Fb_yGaWFtzkzh6~&a_VV;G7O}tGE7!(wUbKC8 z!&{z=M-TpVzUwrRD|LG`yQ(Jf{#EZo&%}@afBf void: _selected_discovery_index = -1 _clear_edit_state() _refresh_entries() + if mode == Mode.DISCOVER and not _discovery_rooms.is_empty(): + _select_discovery_index(0) _refresh() if mode == Mode.DISCOVER: _discovery_refresh_timer.start() @@ -465,10 +467,8 @@ func _cancel_delete() -> void: func _on_list_item_selected(index: int) -> void: if _mode == Mode.DISCOVER: - if index < 0 or index >= _discovery_rooms.size(): + if not _select_discovery_index(index): return - _selected_discovery_index = index - _selected_entry = null _refresh() return if index < 0 or index >= _visible_entries.size(): @@ -486,6 +486,15 @@ func _select_entry_id(entry_id: String) -> void: return +func _select_discovery_index(index: int) -> bool: + if index < 0 or index >= _discovery_rooms.size(): + return false + _selected_discovery_index = index + _selected_entry = null + _server_list.select(index) + return true + + func _refresh_entries() -> void: _visible_entries.clear() _server_list.clear() @@ -906,9 +915,10 @@ func _on_discovery_rooms_updated(rooms: Array[Dictionary]) -> void: if not selected_id.is_empty(): for index: int in _discovery_rooms.size(): if str(_discovery_rooms[index].get("room_id", "")) == selected_id: - _selected_discovery_index = index - _server_list.select(index) + _select_discovery_index(index) break + if _selected_discovery_index < 0 and not _discovery_rooms.is_empty(): + _select_discovery_index(0) _refresh()