[PR #6873] [MERGED] Options: a keyboard-focused widget's tooltip stays by its widget #7162

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

📋 Pull Request Information

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

Base: main ← Head: fix/menu-tooltip


📝 Commits (2)

  • 884b7df Options: a keyboard-focused widget's tooltip stays by its widget
  • 6c8f7a1 getOffset divides the distance by the height as ints, as vanilla does

📊 Changes

2 files changed (+126 additions, -13 deletions)

View changed files

📝 crates/horizon-client-render/src/options_ui.rs (+12 -4)
📝 crates/horizon-client-render/src/ui.rs (+114 -9)

📄 Description

Vanilla: WidgetTooltipHolder.createTooltipPositioner gives a widget with the keyboard focus a MenuTooltipPositioner. With MARGIN 5 and MOUSE_OFFSET_X 12, it starts 12 pixels right of the pointer, mirrors to the left when the tooltip would pass the right margin, keeps 3 to 5 pixels from the widget's top or bottom edge (getOffset over MAX_OVERLAP_WITH_WIDGET 3 and MAX_DISTANCE_TO_WIDGET 5), and moves the tooltip above the widget when there is no room below.

What Horizon got wrong: the options UI shows a focused widget's tooltip (it is part of the hover || is_focused path) but drew every tooltip at the pointer with the default positioner. Steering with the keyboard or a controller therefore showed the description far from the widget. ui::tooltip_menu now measures the tooltip and places it with menu_tooltip_position, the ported positioner; the options screen passes the focused widget's rectangle when the pointer is not over it, and keeps the pointer positioner for hover.

Proven: cargo test -q -p horizon-client-render --lib ui::tests::a_menu_tooltip_stays_by_its_widget -> 1 passed; 0 failed; 1098 filtered out, covering the 12 px offset, the right-edge mirror, and the tooltip above a widget at the bottom. cargo test -q -p horizon-client-render --lib options_ui::tests -> 56 passed; 0 failed; 2 ignored. cargo clippy -q -p horizon-client-render --lib -> clean. rustfmt --edition 2024 --check on both files -> clean.

Not proven: no in-game run. In-game check: open any options page, Tab to a widget without moving the mouse, and confirm its tooltip sits by the widget rather than by the pointer.


🔄 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/6873 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/menu-tooltip` --- ### 📝 Commits (2) - [`884b7df`](https://github.com/horizon-rust/horizon/commit/884b7dfcefb7a095570c186f2f6b9cff2458339a) Options: a keyboard-focused widget's tooltip stays by its widget - [`6c8f7a1`](https://github.com/horizon-rust/horizon/commit/6c8f7a1ededa77090f29885a1fbcb7a76ed3080e) getOffset divides the distance by the height as ints, as vanilla does ### 📊 Changes **2 files changed** (+126 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/options_ui.rs` (+12 -4) 📝 `crates/horizon-client-render/src/ui.rs` (+114 -9) </details> ### 📄 Description Vanilla: `WidgetTooltipHolder.createTooltipPositioner` gives a widget with the keyboard focus a `MenuTooltipPositioner`. With `MARGIN` 5 and `MOUSE_OFFSET_X` 12, it starts 12 pixels right of the pointer, mirrors to the left when the tooltip would pass the right margin, keeps 3 to 5 pixels from the widget's top or bottom edge (`getOffset` over `MAX_OVERLAP_WITH_WIDGET` 3 and `MAX_DISTANCE_TO_WIDGET` 5), and moves the tooltip above the widget when there is no room below. What Horizon got wrong: the options UI shows a focused widget's tooltip (it is part of the `hover || is_focused` path) but drew every tooltip at the pointer with the default positioner. Steering with the keyboard or a controller therefore showed the description far from the widget. `ui::tooltip_menu` now measures the tooltip and places it with `menu_tooltip_position`, the ported positioner; the options screen passes the focused widget's rectangle when the pointer is not over it, and keeps the pointer positioner for hover. **Proven:** `cargo test -q -p horizon-client-render --lib ui::tests::a_menu_tooltip_stays_by_its_widget` -> `1 passed; 0 failed; 1098 filtered out`, covering the 12 px offset, the right-edge mirror, and the tooltip above a widget at the bottom. `cargo test -q -p horizon-client-render --lib options_ui::tests` -> `56 passed; 0 failed; 2 ignored`. `cargo clippy -q -p horizon-client-render --lib` -> clean. `rustfmt --edition 2024 --check` on both files -> clean. **Not proven:** no in-game run. In-game check: open any options page, Tab to a widget without moving the mouse, and confirm its tooltip sits by the widget rather than by the pointer. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:35:06 +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#7162
No description provided.