Skip to content

Robust Scrolling Example #19586

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

tim-blackbird
Copy link
Contributor

@tim-blackbird tim-blackbird commented Jun 11, 2025

Objective

A more robust scrolling example that doesn't require Pickable { should_block_lower: false, .. } or Pickable::IGNORE, and properly handles nested scrolling nodes.

The current example shows nested scrolling, but this is only functional because the parent scrolls along a different axis than the children.

Solution

Instead of only scrolling the top node that is found in the HoverMap we trigger the OnScroll event on it.
This event then propagates up the hierarchy until any scrolling node that has room to scroll along that axis consumes the event.

The now redundant Pickable components were removed from the example.
The “Nested Scrolling Lists” portion was adjusted to show the new reliable nested scrolling.

Testing

Check out the example. It should work just as it did before.

@tim-blackbird tim-blackbird added C-Examples An addition or correction to our examples A-UI Graphical user interfaces, styles, layouts, and widgets S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jun 11, 2025
@alice-i-cecile alice-i-cecile added the X-Uncontroversial This work is generally agreed upon label Jun 11, 2025
Copy link
Contributor

@viridia viridia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. This should also play well with scrollbars (I have a prototype).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Examples An addition or correction to our examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward X-Uncontroversial This work is generally agreed upon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants