[PR #6778] [MERGED] Options: a clicked option no longer takes the wheel #7087

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

📋 Pull Request Information

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

Base: main ← Head: fix/options-wheel-scroll


📝 Commits (1)

  • 0d15238 Options: a clicked option no longer takes the wheel

📊 Changes

1 file changed (+113 additions, -9 deletions)

View changed files

📝 crates/horizon-client-render/src/options_ui.rs (+113 -9)

📄 Description

Vanilla behaviour

The wheel goes to the hovered widget, then to the list. AbstractScrollArea.mouseScrolled only scrolls: setScrollAmount(scrollAmount() - scrollY * scrollRate()). CycleButton.mouseScrolled overrides it, cycles and keeps the wheel — scrollY > 0 calls cycleValue(-1), scrollY < 0 calls cycleValue(1), and it returns true — so a pointer resting on a cycle button cycles it and the list stays put. AbstractSliderButton and AbstractButton do not override it, so a slider under the cursor lets the list scroll. Focus plays no part: a click focuses a button for its highlight, and the wheel does not consult that focus anywhere.

What Horizon got wrong

OptionsUi keeps one focus for keyboard navigation and for the highlight, and the mouse click loop set it (options_ui.rs, self.focus = Some(focus_id(wd_idx, &wd))). wheel treated any FocusId::Slider or FocusId::Cycle as "keyboard-focused", stepped or cycled it wherever the cursor was, and returned before scroll_at. So after clicking any option, every later wheel event toggled that option — a trackpad's stream of small deltas made it flip back and forth — and the list could not scroll even with the pointer over empty space.

focus_from_keyboard now records how the focus was taken. Tab/Shift-Tab, the arrow keys and the pad's focus steps set it; a mouse click clears it, as does every place the focus is cleared. The wheel's focus branch requires it, so the written keyboard divergence (a keyboard-focused slider or cycle button steps from anywhere) is unchanged, while a click no longer hands the wheel a widget to toggle. The hovered-cycle branch is untouched: it is vanilla's CycleButton.mouseScrolled, not a Horizon extra.

Proven

cargo test -q -p horizon-client-render --lib a_clicked_option_lets_the_wheel_scroll_the_list — passes:

  • a click on a visible cycle button on the Video page leaves focus on it with focus_from_keyboard == false;
  • a wheel event over the list's empty margin at a size where the page overflows emits no ButtonClick and no Changed, leaves the option's value alone and increases the list's scroll offset;
  • with the flag set (the keyboard case) the same event at the same cursor position cycles the option and emits ButtonClick + Changed.

cargo test -q -p horizon-client-render --lib wheel — the existing wheel tests still pass, including the hovered slider parity cases and the Extras switch.

cargo clippy -q -p horizon-client-render --lib and rustfmt --edition 2024 --check — clean.

Not proven

Not driven in a window: this machine is headless. In-game check: click an option, then scroll with the pointer off the buttons — the list scrolls and the option keeps its value; then rest the pointer on a cycle button and scroll — it still cycles and the list stays put, as vanilla does.


🔄 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/6778 **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/options-wheel-scroll` --- ### 📝 Commits (1) - [`0d15238`](https://github.com/horizon-rust/horizon/commit/0d15238cc3353360d58c42fe66c9d4e52f4f7313) Options: a clicked option no longer takes the wheel ### 📊 Changes **1 file changed** (+113 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/options_ui.rs` (+113 -9) </details> ### 📄 Description ## Vanilla behaviour The wheel goes to the hovered widget, then to the list. `AbstractScrollArea.mouseScrolled` only scrolls: `setScrollAmount(scrollAmount() - scrollY * scrollRate())`. `CycleButton.mouseScrolled` overrides it, cycles and keeps the wheel — `scrollY > 0` calls `cycleValue(-1)`, `scrollY < 0` calls `cycleValue(1)`, and it returns true — so a pointer resting on a cycle button cycles it and the list stays put. `AbstractSliderButton` and `AbstractButton` do not override it, so a slider under the cursor lets the list scroll. Focus plays no part: a click focuses a button for its highlight, and the wheel does not consult that focus anywhere. ## What Horizon got wrong `OptionsUi` keeps one `focus` for keyboard navigation and for the highlight, and the mouse click loop set it (`options_ui.rs`, `self.focus = Some(focus_id(wd_idx, &wd))`). `wheel` treated any `FocusId::Slider` or `FocusId::Cycle` as "keyboard-focused", stepped or cycled it **wherever the cursor was**, and returned before `scroll_at`. So after clicking any option, every later wheel event toggled that option — a trackpad's stream of small deltas made it flip back and forth — and the list could not scroll even with the pointer over empty space. `focus_from_keyboard` now records how the focus was taken. Tab/Shift-Tab, the arrow keys and the pad's focus steps set it; a mouse click clears it, as does every place the focus is cleared. The wheel's focus branch requires it, so the written keyboard divergence (a keyboard-focused slider or cycle button steps from anywhere) is unchanged, while a click no longer hands the wheel a widget to toggle. The hovered-cycle branch is untouched: it is vanilla's `CycleButton.mouseScrolled`, not a Horizon extra. ## Proven `cargo test -q -p horizon-client-render --lib a_clicked_option_lets_the_wheel_scroll_the_list` — passes: - a click on a visible cycle button on the Video page leaves `focus` on it with `focus_from_keyboard == false`; - a wheel event over the list's empty margin at a size where the page overflows emits no `ButtonClick` and no `Changed`, leaves the option's value alone and increases the list's scroll offset; - with the flag set (the keyboard case) the same event at the same cursor position cycles the option and emits `ButtonClick` + `Changed`. `cargo test -q -p horizon-client-render --lib wheel` — the existing wheel tests still pass, including the hovered slider parity cases and the Extras switch. `cargo clippy -q -p horizon-client-render --lib` and `rustfmt --edition 2024 --check` — clean. ## Not proven Not driven in a window: this machine is headless. In-game check: click an option, then scroll with the pointer off the buttons — the list scrolls and the option keeps its value; then rest the pointer on a cycle button and scroll — it still cycles and the list stays put, as vanilla does. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:33:34 +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#7087
No description provided.