[PR #6350] [MERGED] Let Tab reach the world list so a keyboard player can join #6818

Closed
opened 2026-11-03 06:27:30 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6350
Author: @MSedgeMC
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: fix/title-tab-list


📝 Commits (1)

  • 0de0b1d Let Tab reach the world list so a keyboard player can join

📊 Changes

1 file changed (+38 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/title.rs (+38 -1)

📄 Description

WorldSelectionList.WorldListEntry.keyPressed joins the world when the list entry has focus:

// javap -p -c on WorldSelectionList$WorldListEntry
 1: invokevirtual KeyEvent.isSelection           // Enter, keypad Enter or Space
 4: ifeq          53
 8: invokevirtual canInteract
32-52: play UI_BUTTON_CLICK, then list.onEntryInteract.accept(this) and return true

Horizon already had that half: confirm_key_size calls join_selected when the list is
focused, and the arrow keys move the selected row. What it did not have was a way to get
there: tab_dir for Mode::Select went from the focused search box straight to the first
button (search_focused = false; focused_button = enabled.first()), and every later state
had a button focused, so list_focused() - which needs !search_focused and no focused
button - was never true after entering the screen. The list could only be clicked.

Tab now hands focus from the search box to the list, and the next Tab moves on to the buttons
in the direction it was pressed.

Proven: on the build VM, cargo test -q -p horizon-client --lib tab_walks_from_the_search_box_to_the_world_list
→ 1 passed: after one Tab the search box is unfocused, the list is focused and no button is,
and after a second Tab a button is focused. With the old one-line body restored the same test
→ FAILED.

Not proven: the join itself is not under test (it needs a real world on disk and a client);
the in-game check is Tab, Down, Enter on the Select World screen with a keyboard only.

Note (added after the crate split): the tests under crates/horizon-client/src/ other than game/ and entry/ are now compiled by the horizon-client-lib crate, so the command above is cargo test -p horizon-client-lib --lib <filter> on current main. The change and the assertions are unchanged.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/6350 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/title-tab-list` --- ### 📝 Commits (1) - [`0de0b1d`](https://github.com/horizon-rust/horizon/commit/0de0b1d1b7f8fd1f1d8b2f154ffd97ff2be51bde) Let Tab reach the world list so a keyboard player can join ### 📊 Changes **1 file changed** (+38 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/title.rs` (+38 -1) </details> ### 📄 Description `WorldSelectionList.WorldListEntry.keyPressed` joins the world when the list entry has focus: ```java // javap -p -c on WorldSelectionList$WorldListEntry 1: invokevirtual KeyEvent.isSelection // Enter, keypad Enter or Space 4: ifeq 53 8: invokevirtual canInteract 32-52: play UI_BUTTON_CLICK, then list.onEntryInteract.accept(this) and return true ``` Horizon already had that half: `confirm_key_size` calls `join_selected` when the list is focused, and the arrow keys move the selected row. What it did not have was a way to *get* there: `tab_dir` for `Mode::Select` went from the focused search box straight to the first button (`search_focused = false; focused_button = enabled.first()`), and every later state had a button focused, so `list_focused()` - which needs `!search_focused` and no focused button - was never true after entering the screen. The list could only be clicked. Tab now hands focus from the search box to the list, and the next Tab moves on to the buttons in the direction it was pressed. **Proven:** on the build VM, `cargo test -q -p horizon-client --lib tab_walks_from_the_search_box_to_the_world_list` → `1 passed`: after one Tab the search box is unfocused, the list is focused and no button is, and after a second Tab a button is focused. With the old one-line body restored the same test → `FAILED`. **Not proven:** the join itself is not under test (it needs a real world on disk and a client); the in-game check is Tab, Down, Enter on the Select World screen with a keyboard only. Note (added after the crate split): the tests under `crates/horizon-client/src/` other than `game/` and `entry/` are now compiled by the `horizon-client-lib` crate, so the command above is `cargo test -p horizon-client-lib --lib <filter>` on current main. The change and the assertions are unchanged. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:27:30 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#6818
No description provided.