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.
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.