AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
25.96k stars 2.25k forks source link

ListBox inside Popup not scrolling with PointWheelChanged #16646

Open gebodal opened 3 months ago

gebodal commented 3 months ago

Describe the bug

On Windows, the pointer scrollwheel is not scrolling a ListBox inside a Popup (no error thrown, but no effect on the control). The ListBox responds to the scrollwheel as expected when inside a Grid (or StackPanel).

However, on Ubuntu and Mac, the ListBox responds as expected in both situations.

To Reproduce

This project contains an example of the issue: ListBoxScrollTest.zip

Tested with the desktop lifetime, on Windows 10 Home and Ubuntu 20.04 (and MacOS, but I'm afraid I borrowed that, and I didn't note down the OS version).

Expected behavior

The PointerWheelChanged event should cause the ListBox to scroll regardless of whether it is a child of a Grid or a Popup.

Avalonia version

11.1.2

OS

Windows

Additional context

The PointerWheelChanged event does not propagate to the ListBox control when inside the Popup, and only gets as far as the LightDismissOverlayLayer, as seen in DevTools when the mouse wheel is scrolled over the control (Windows 10 Home):

356591067-1e1b7aeb-a5dd-4bdd-a938-82d10b308de7

So the scrollwheel has no effect on that ListBox.

For the ListBox that is a direct child of the Grid, the event propagates fully into the ListBox template elements (Windows 10 Home):

356591237-1f9f9493-5257-4596-8c20-d1128d55af90

gebodal commented 3 months ago

(Apologies for the close/unclose, clicking all the wrong buttons today)

stevemonaco commented 3 months ago

Need some clarity here. I ran the repro on Win11 and get the following behaviors:

  1. The ListBox-in-Grid scrolls with mouse wheel when hovered.
  2. The ListBox-in-Popup scrolls with mouse wheel when hovered.
  3. The ListBox-in-Popup and ListBox-in-Grid do not scroll with mouse wheel when the cursor is outside of the Popup bounds.

Which scenario is at issue or is it something else? A short screen capture might help here.

gebodal commented 3 months ago

It’s scenario 2 that isn’t working on my machine. None of the following cause scrolling for scenario 2:

I can try and get a screen capture for you, but it would mostly be things not happening, so I’m not sure how helpful that would be. Would it be useful to have DevTools output as well? What would be the information to show? (Apologies, I’m new to debugging Avalonia like this)

gebodal commented 3 months ago

Something like this?

https://github.com/user-attachments/assets/0db1cb2a-3023-4fed-bdf2-839696b7c2d6

stevemonaco commented 3 months ago

Weird. I only get (Win11) the tunnel event through LightDismissOverlayLayer while not hovering the ListBox-in-Popup. When hovering, it properly goes through the ContentPresenter, MainView, etc.

gebodal commented 3 months ago

I'm not getting LightDismissOverlayLayer when hovering outside of both ListBoxes? It just tunnels MainWindow > Panel > Panel and then bubbles back out again.

gebodal commented 3 months ago

As in:

https://github.com/user-attachments/assets/ddc4a8ac-22ca-419d-8c52-1a1897ca8ef6