[PR #241] [MERGED] Controllers: focus navigation in menus, on-screen keyboard, menu navigation option #2430

Closed
opened 2026-11-02 15:56:01 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/241
Author: @ludovic111
Created: 10/14/2026
Status: ✅ Merged
Merged: 10/15/2026
Merged by: @ludovic111

Base: main ← Head: feat/controllers2-focus


📝 Commits (4)

  • 9927d06 Controllers: focus navigation in menus, on-screen keyboard, menu navigation option
  • 210a6f5 Controllers: focus follows scrolled lists, clipped targets, pad status shows focus
  • 6356226 Controllers: options sub-pages keep the classic focus highlight under the Horizon style
  • bf74ac6 Controllers: the Steam keyboard choice falls back to Horizon's without xdg-open

📊 Changes

23 files changed (+2056 additions, -155 deletions)

View changed files

📝 crates/horizon-client/src/game/beacon.rs (+11 -0)
📝 crates/horizon-client/src/game/books.rs (+7 -2)
📝 crates/horizon-client/src/game/lan_screen.rs (+20 -7)
📝 crates/horizon-client/src/game/loom.rs (+18 -0)
📝 crates/horizon-client/src/game/pad.rs (+9 -12)
📝 crates/horizon-client/src/game/pad_menu.rs (+713 -79)
📝 crates/horizon-client/src/game/recipe_book.rs (+60 -0)
📝 crates/horizon-client/src/game/remote.rs (+27 -6)
📝 crates/horizon-client/src/game/sign_edit.rs (+15 -6)
📝 crates/horizon-client/src/game/stations.rs (+32 -0)
📝 crates/horizon-client/src/game/trading.rs (+10 -0)
📝 crates/horizon-client/src/gamepad.rs (+364 -1)
📝 crates/horizon-client/src/lib.rs (+1 -0)
📝 crates/horizon-client/src/multiplayer.rs (+12 -0)
📝 crates/horizon-client/src/options_horizon.rs (+6 -0)
📝 crates/horizon-client/src/options_ui.rs (+30 -0)
➕ crates/horizon-client/src/osk.rs (+412 -0)
📝 crates/horizon-client/src/screen_draw.rs (+9 -0)
📝 crates/horizon-client/src/title.rs (+12 -0)
📝 crates/horizon-client/src/ui.rs (+11 -1)

...and 3 more files

📄 Description

First of the four second-round controller PRs (see the PR plan in docs/controllers.md). This one adds console-style focus navigation in menus, the option to keep the pointer instead, and an on-screen keyboard for text fields.

What it does

  • Menu navigation: Focus / Pointer (Options → Controls → Controller), default Focus.
    • Focus is the default because every screen now registers its targets. A focus ring that always lands on something is faster than steering a pointer with a stick, and it is what console players expect.
    • Pointer keeps the existing virtual pointer, unchanged. RS click switches to the pointer for one screen, for anything focus can't name (see below).
  • Focus targets. Every screen registers what it draws (widgets::target_as): buttons, sliders, fields, list rows, slots and tabs. The step is vanilla 26.3's arrow-key navigation (nextFocusPathInDirection): a strict pass, then a vague pass.
    • D-pad and left stick move the focus.
    • A activates, B goes back, LB/RB switch tabs (creative, Horizon option sections), left/right move a focused slider.
    • X/Y are contextual: in inventories X splits and Y quick-moves; elsewhere they are the screen's secondary action.
    • Lists follow the focus: a step past the visible rows scrolls the list and retries on the next frame.
  • Focus highlight in both styles.
    • Classic style: vanilla's own keyboard-focus look (hover sprites, a white 1-px outline on rows and fields).
    • Horizon style: a 2-dp accent ring from horizon-theme. The options' sub-pages stay classic under either style.
  • Inventories.
    • Slot focus, with quick-move, split and drop.
    • The carried stack is drawn on the focused slot.
  • On-screen keyboard (osk.rs).
    • A on a text field opens a Horizon-styled keyboard: chat, signs, books, world names, server addresses, search fields.
    • On a Steam Deck it opens Steam's keyboard instead. Option Text keyboard: Auto / Horizon / Steam.
  • horizon-ctl pad status now reports the menu mode, the focused target, the target list and the keyboard state, so injected-pad tests can check focus.

Screens covered

Focus mode registers targets on:

  • the title menus: main, world list and its search, create, edit and delete world, the multiplayer list and its edit screens
  • every options page (classic pages and the Horizon-style sections, key and controller binds, language list)
  • pause, death, chat, signs and books
  • the survival and creative inventories
  • every container and station: chests, furnaces, brewing, crafter, crafting table with its recipe book, anvil, grindstone, smithing, stonecutter, loom, cartography, enchanting, beacon, villager trades, mount inventories
  • LAN / world options

Where a screen draws something clickable that no target names (the advancements map, the statistics lists, the pack screen's rows), RS click gives the pointer for that screen. Both modes reach every screen.

Screenshots (vscreen, injected virtual pad)

Classic title, focus on a button
Horizon title
Horizon options
Horizon Controls section scrolled to follow the focus (ring on Look Deadzone)
Classic Controls sub-page, vanilla highlight
Create World
Inventory slot focus
Creative tabs with RB
Chat on-screen keyboard

Tests

  • Unit tests:
    • gamepad.rs: the focus step (strict and vague passes, ties, scroll shift) and the mode and keyboard options round-trip.
    • widgets.rs: target registry, clipping, generations.
    • osk.rs: layout, key moves, text, backspace and enter.
  • Injected pad (horizon-ctl pad … + pad status): I drove every screen in the screenshots on vscreen and checked focus moves, scroll-follow, tabs, sliders, A/B and the keyboard in both menu styles.

Review (2026-10-15, before merge)

  • Rebased on main (clean). The focus step was checked against vanilla 26.3's ContainerEventHandler.nextFocusPathInDirection / nextFocusPathVaguelyInDirection: same strict filter, sort (facing bound, then the other axis' low edge) and vague squared distance.
  • Fixed: with the keyboard option set to Steam by hand on macOS or Windows, A on a text field opened nothing (no xdg-open); it now falls back to Horizon's keyboard.
  • In game on the Mac mini (offscreen, injected pad through horizon-ctl pad): with no pad input the title screen looks exactly like vanilla; the D-pad moves vanilla's highlight and skips disabled buttons (Realms); A opens Options (9 targets, disabled ones skipped), B comes back with focus restored; menuNavigation:pointer gives the virtual pointer and no focus; creative inventory slot focus down to the tab row, RB switches tabs; chat with A opens the on-screen keyboard, which typed into the field.
  • pr_ready --quick (ThinkPad): fmt, clippy, 639 horizon-client tests pass; 122 harnesses left to CI parity.

Needs a real controller

  • How the stick repeat rate feels.
  • Whether Steam's keyboard opens in Game Mode on a Steam Deck. It goes through steam://open/keyboard, which I can't test without one.

The next PRs add button prompts and rebinding, DualSense output, and the launcher.

🤖 Generated with Claude Code


🔄 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/241 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/14/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/controllers2-focus` --- ### 📝 Commits (4) - [`9927d06`](https://github.com/horizon-rust/horizon/commit/9927d06049c27fcf0c4da50fca901be80f4daf7e) Controllers: focus navigation in menus, on-screen keyboard, menu navigation option - [`210a6f5`](https://github.com/horizon-rust/horizon/commit/210a6f5dddfd04ccbf9a7b93eeedd4b4b9dfce10) Controllers: focus follows scrolled lists, clipped targets, pad status shows focus - [`6356226`](https://github.com/horizon-rust/horizon/commit/635622652e16abe29802a72f53a108ba9028b9a1) Controllers: options sub-pages keep the classic focus highlight under the Horizon style - [`bf74ac6`](https://github.com/horizon-rust/horizon/commit/bf74ac6f30fee8bbc03662899e01085f389a1255) Controllers: the Steam keyboard choice falls back to Horizon's without xdg-open ### 📊 Changes **23 files changed** (+2056 additions, -155 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/beacon.rs` (+11 -0) 📝 `crates/horizon-client/src/game/books.rs` (+7 -2) 📝 `crates/horizon-client/src/game/lan_screen.rs` (+20 -7) 📝 `crates/horizon-client/src/game/loom.rs` (+18 -0) 📝 `crates/horizon-client/src/game/pad.rs` (+9 -12) 📝 `crates/horizon-client/src/game/pad_menu.rs` (+713 -79) 📝 `crates/horizon-client/src/game/recipe_book.rs` (+60 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+27 -6) 📝 `crates/horizon-client/src/game/sign_edit.rs` (+15 -6) 📝 `crates/horizon-client/src/game/stations.rs` (+32 -0) 📝 `crates/horizon-client/src/game/trading.rs` (+10 -0) 📝 `crates/horizon-client/src/gamepad.rs` (+364 -1) 📝 `crates/horizon-client/src/lib.rs` (+1 -0) 📝 `crates/horizon-client/src/multiplayer.rs` (+12 -0) 📝 `crates/horizon-client/src/options_horizon.rs` (+6 -0) 📝 `crates/horizon-client/src/options_ui.rs` (+30 -0) ➕ `crates/horizon-client/src/osk.rs` (+412 -0) 📝 `crates/horizon-client/src/screen_draw.rs` (+9 -0) 📝 `crates/horizon-client/src/title.rs` (+12 -0) 📝 `crates/horizon-client/src/ui.rs` (+11 -1) _...and 3 more files_ </details> ### 📄 Description First of the four second-round controller PRs (see the PR plan in `docs/controllers.md`). This one adds console-style focus navigation in menus, the option to keep the pointer instead, and an on-screen keyboard for text fields. ## What it does - **Menu navigation: Focus / Pointer** (Options → Controls → Controller), default **Focus**. - Focus is the default because every screen now registers its targets. A focus ring that always lands on something is faster than steering a pointer with a stick, and it is what console players expect. - Pointer keeps the existing virtual pointer, unchanged. RS click switches to the pointer for one screen, for anything focus can't name (see below). - **Focus targets.** Every screen registers what it draws (`widgets::target_as`): buttons, sliders, fields, list rows, slots and tabs. The step is vanilla 26.3's arrow-key navigation (`nextFocusPathInDirection`): a strict pass, then a vague pass. - D-pad and left stick move the focus. - A activates, B goes back, LB/RB switch tabs (creative, Horizon option sections), left/right move a focused slider. - X/Y are contextual: in inventories X splits and Y quick-moves; elsewhere they are the screen's secondary action. - Lists follow the focus: a step past the visible rows scrolls the list and retries on the next frame. - **Focus highlight in both styles.** - Classic style: vanilla's own keyboard-focus look (hover sprites, a white 1-px outline on rows and fields). - Horizon style: a 2-dp accent ring from `horizon-theme`. The options' sub-pages stay classic under either style. - **Inventories.** - Slot focus, with quick-move, split and drop. - The carried stack is drawn on the focused slot. - **On-screen keyboard** (`osk.rs`). - A on a text field opens a Horizon-styled keyboard: chat, signs, books, world names, server addresses, search fields. - On a Steam Deck it opens Steam's keyboard instead. Option **Text keyboard: Auto / Horizon / Steam**. - `horizon-ctl pad status` now reports the menu mode, the focused target, the target list and the keyboard state, so injected-pad tests can check focus. ## Screens covered Focus mode registers targets on: - the title menus: main, world list and its search, create, edit and delete world, the multiplayer list and its edit screens - every options page (classic pages and the Horizon-style sections, key and controller binds, language list) - pause, death, chat, signs and books - the survival and creative inventories - every container and station: chests, furnaces, brewing, crafter, crafting table with its recipe book, anvil, grindstone, smithing, stonecutter, loom, cartography, enchanting, beacon, villager trades, mount inventories - LAN / world options Where a screen draws something clickable that no target names (the advancements map, the statistics lists, the pack screen's rows), RS click gives the pointer for that screen. Both modes reach every screen. ## Screenshots (vscreen, injected virtual pad) | | | |---|---| | Classic title, focus on a button<br><img src="https://raw.githubusercontent.com/ludovic111/horizon/39b571619076fad1bcbacb0bbff3c81d50057b12/controllers2/focus/title-focus.png" width="420"> | Horizon title<br><img src="https://raw.githubusercontent.com/ludovic111/horizon/39b571619076fad1bcbacb0bbff3c81d50057b12/controllers2/focus/h-title.png" width="420"> | | Horizon options<br><img src="https://raw.githubusercontent.com/ludovic111/horizon/39b571619076fad1bcbacb0bbff3c81d50057b12/controllers2/focus/h-opt.png" width="420"> | Horizon Controls section scrolled to follow the focus (ring on Look Deadzone)<br><img src="https://raw.githubusercontent.com/ludovic111/horizon/39b571619076fad1bcbacb0bbff3c81d50057b12/controllers2/focus/h-controls-scroll.png" width="420"> | | Classic Controls sub-page, vanilla highlight<br><img src="https://raw.githubusercontent.com/ludovic111/horizon/39b571619076fad1bcbacb0bbff3c81d50057b12/controllers2/focus/classic-controls-fixed.png" width="420"> | Create World<br><img src="https://raw.githubusercontent.com/ludovic111/horizon/39b571619076fad1bcbacb0bbff3c81d50057b12/controllers2/focus/create.png" width="420"> | | Inventory slot focus<br><img src="https://raw.githubusercontent.com/ludovic111/horizon/39b571619076fad1bcbacb0bbff3c81d50057b12/controllers2/focus/inv2.png" width="420"> | Creative tabs with RB<br><img src="https://raw.githubusercontent.com/ludovic111/horizon/39b571619076fad1bcbacb0bbff3c81d50057b12/controllers2/focus/creative.png" width="420"> | | Chat on-screen keyboard<br><img src="https://raw.githubusercontent.com/ludovic111/horizon/39b571619076fad1bcbacb0bbff3c81d50057b12/controllers2/focus/osk.png" width="420"> | | ## Tests - **Unit tests:** - `gamepad.rs`: the focus step (strict and vague passes, ties, scroll shift) and the mode and keyboard options round-trip. - `widgets.rs`: target registry, clipping, generations. - `osk.rs`: layout, key moves, text, backspace and enter. - **Injected pad** (`horizon-ctl pad …` + `pad status`): I drove every screen in the screenshots on vscreen and checked focus moves, scroll-follow, tabs, sliders, A/B and the keyboard in both menu styles. ## Review (2026-10-15, before merge) - Rebased on main (clean). The focus step was checked against vanilla 26.3's `ContainerEventHandler.nextFocusPathInDirection` / `nextFocusPathVaguelyInDirection`: same strict filter, sort (facing bound, then the other axis' low edge) and vague squared distance. - **Fixed:** with the keyboard option set to Steam by hand on macOS or Windows, A on a text field opened nothing (no `xdg-open`); it now falls back to Horizon's keyboard. - **In game on the Mac mini** (offscreen, injected pad through `horizon-ctl pad`): with no pad input the title screen looks exactly like vanilla; the D-pad moves vanilla's highlight and skips disabled buttons (Realms); A opens Options (9 targets, disabled ones skipped), B comes back with focus restored; `menuNavigation:pointer` gives the virtual pointer and no focus; creative inventory slot focus down to the tab row, RB switches tabs; chat with A opens the on-screen keyboard, which typed into the field. - `pr_ready --quick` (ThinkPad): fmt, clippy, 639 horizon-client tests pass; 122 harnesses left to CI parity. ## Needs a real controller - How the stick repeat rate feels. - Whether Steam's keyboard opens in Game Mode on a Steam Deck. It goes through `steam://open/keyboard`, which I can't test without one. The next PRs add button prompts and rebinding, DualSense output, and the launcher. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:56:01 +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#2430
No description provided.