Mouse Wheel Event Handling Issue with Multiple ScrollContainers

Godot Version

4.4.1

Question

In my interface with multiple ScrollContainers, when I hover my mouse over any ScrollContainer, the mouse wheel events are correctly handled by the container under the cursor. However, when I press and hold the left mouse button on one ScrollContainer and then drag the mouse to another ScrollContainer area, the wheel events continue to be processed by the initially clicked container, not the one currently under the cursor.
This becomes inconvenient during drag and drop operations or UI interactions, as users cannot scroll other containers during the drag process.

If I remember right, toggling the following to Stop will stop propagating mouse input to other controls if it leave the ScrollContainer.

In the ScrollControl Inspector go to: Control->Mouse->Filter->Stop

That should solve the problem. iirc

1 Like

That is a very interesting use case for mouse-wheel, which is currently not supported, but makes perfect sense.
I would like to invite you to create a proposal for this on the github Godot proposal repository: GitHub - godotengine/godot-proposals: Godot Improvement Proposals (GIPs)

1 Like

I tried a slightly tedious approach where I call grab_click_focus() when the mouse_entered() signal of the ScrollContainer is triggered. This ensures that dragging will scroll the ScrollContainer under the mouse. However, this also made the ScrollContainer’s scrollbar unusable - it’s easy to lose focus when dragging the scrollbar. To solve this, I added a controller that makes the ScrollContainer emit a request focus signal when the mouse enters it. The controller then decides whether to allow grabbing focus (e.g., only allowing focus grab during item dragging). So far, this solution works well in my project, though it might not be universally applicable.