Skip to content

Scroll: a wheel over a scroll bar scrolls the viewport it follows - #1214

Merged
thdxr merged 1 commit into
devfrom
fix-wheel-over-scrollbar
Nov 19, 2026
Merged

thdxr merged 1 commit into
devfrom
fix-wheel-over-scrollbar

Conversation

@thdxr

@thdxr thdxr commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

fixes #1200.

the bar's track draws over the viewport's right edge as its sibling (both in the area column), and since #1137 a wheel starts on the topmost hit and chains up its ancestors. so a wheel over the bar's strip started on the track, whose only ancestors were the area column and the window, and found no scroller: every scroll view lost wheel scrolling over its rightmost points, and a wide table lost its sideways wheel.

El::wheel_scrolls(key) names the viewport an element's wheel belongs to, and the kit's bars name the viewport they follow. the hand-off lives in scroll_in_chain (pointer.rs), which both axes walk, so a wheel over the bar scrolls the viewport it follows on whichever axis it turned, then chains on up from it when that one is at its end. chromium's scrollbar belongs to its scroller the same way; a press or drag on the bar is unchanged.

the key is resolved in the element's own place: looked up inside the element itself, then its ancestors, innermost first, so panes and tables that key their viewports alike each take their own wheel (markdown/table.rs keys every wide table's viewport scroll). the first scope holding a match decides — one on its way out or inert hands the wheel nowhere rather than to another pane's. in_scope's key-name scoping can't tell repeated keys apart, so the boundary is the tree's own subtree while the match inside it is named, as Tx::scroll_into_view names one.

on_wheel handlers under the pointer still hear the wheel first; one on the named viewport does not, since the pointer is over the bar and not the viewport.

tests (fail on origin/dev's plain scroll_in_chain, pass here):

  • rune a_sideways_wheel_over_a_bar_scrolls_the_viewport_it_follows: a sideways wheel over a two-way pane's vertical track scrolls it across (x.offset 0 → 40) and leaves it where it was down, and over a table's horizontal track scrolls the table (x.offset 0 → 40). before: both 0.
  • rune a_wheel_over_an_element_that_names_its_viewport_scrolls_that_viewport (0 → 30), a_wheel_a_named_viewport_cannot_take_chains_up_from_it, a_wheel_over_one_pane_s_bar_scrolls_that_pane_when_the_panes_key_alike, a_raised_panel_over_a_bar_keeps_the_wheel_from_the_viewport_under_it.
  • rune-kit markdown::tests::a_wheel_over_a_table_s_scroll_bar_scrolls_its_own_pane: two panes each rendering a wide markdown table — a vertical wheel over the second table's bar scrolls the second pane (before: the first pane scrolled, 30 vs 0), i.e. a vertical wheel over a horizontal bar still chains up to its pane.
  • rune-kit a_wheel_over_the_bar_scrolls_the_viewport_it_follows: the issue's repro.

macOS (macos-tests.yml, workflow_dispatch): run 44466141090 on dece2bf2 — success, and all six wheel tests pass there.

@thdxr

thdxr commented Nov 19, 2026

Copy link
Copy Markdown
Member Author

macOS tests, workflow_dispatch on this branch:

  • run 44455332174: 1835 passed, 1 failed — runtime::tests::scroll_children::scroll_xy_with_direct_children_scrolls_both_axes_and_warns_on_trailing_growth_sibling (!layout_diagnostics::warned_at("growth-sibling:")), which fails the same way on dev (10dd8703, 9f5cadcc). the four new tests pass there.
  • run 44453714164 (first): also had clipboard::macos::tests::every_form_round_trips_in_one_change and images_and_files_are_written_for_other_apps fail on pasteboard changeCount/RTF-derived text; both pass in the rerun above, so that's the pasteboard server being flaky on a shared runner, not this diff.

The bar's track draws over the viewport's right edge as its sibling (both in the `area` column),
and since #1137 a wheel starts on the topmost hit and chains up its ancestors. So a wheel over
the bar's strip started on the track, whose only ancestors were the area column and the window,
and found no scroller: every scroll view lost wheel scrolling over its rightmost points, and a
wide table lost its sideways wheel.

`El::wheel_scrolls(key)` names the viewport an element's wheel belongs to, and the kit's bars name
the viewport they follow. `scroll_in_chain` takes that hand-off before walking on, so it holds on
both axes: a wheel over the bar scrolls the viewport it follows, then chains on up from it when
that one is at its end, as a wheel over the viewport itself does. Chromium's scrollbar belongs to
its scroller the same way; a press or drag on the bar is unchanged.

The key is resolved in the element's own place, looked up inside the element itself and then its
ancestors, innermost first, so panes and tables that key their viewports alike each take their own
wheel (`markdown/table.rs` keys every wide table's viewport `scroll`). The first scope holding a
match decides: one on its way out or inert hands the wheel nowhere rather than to another pane's.
`in_scope`'s key-name scoping can't tell repeated keys apart, so the boundary is the tree's own
subtree, while the match inside it is `named`, as `Tx::scroll_into_view` names one.

`on_wheel` handlers under the pointer still hear the wheel first; one on the named viewport does
not, since the pointer is over the bar and not the viewport.

Fixes #1200.
@thdxr
thdxr force-pushed the fix-wheel-over-scrollbar branch from dddcd4a to dece2bf Compare November 19, 2026 05:34
@thdxr
thdxr merged commit 431469b into dev Nov 19, 2026
3 checks passed
@thdxr
thdxr deleted the fix-wheel-over-scrollbar branch November 19, 2026 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rune-kit scroll bar: a wheel over the track doesn't scroll its viewport

1 participant