UmbraLuminosa / sickle_ui

A widget library built on top of bevy_ui.
Apache License 2.0
205 stars 24 forks source link

Scroll not detected over button #12

Closed UkoeHB closed 1 month ago

UkoeHB commented 3 months ago

Buttons inside a scroll view are a black hole for scroll interactions. This is probably more an issue with Bevy's interaction model than sickle_ui.

eidloi commented 3 months ago

this isn't specific to Bevy actually and it all depends on how focus is captured. I have a component (ScrollThrough) that could be attached to the buttons to force scrolling to pass through them, but I didn't want to automatically do it. Sliders for instance need to capture the scroll themselves even over their button.

UkoeHB commented 3 months ago

I have a component (ScrollThrough) that could be attached to the buttons to force scrolling to pass through them, but I didn't want to automatically do it.

I think it should scroll through by default. It's easy to forget to add this, which means a higher rate of unintended bugs. Opting-in to no-scroll-through means you can do it for specifically those widgets where you want special behavior (and are explicitly testing for it).

eidloi commented 3 months ago

I have a component (ScrollThrough) that could be attached to the buttons to force scrolling to pass through them, but I didn't want to automatically do it.

I think it should scroll through by default. It's easy to forget to add this, which means a higher rate of unintended bugs. Opting-in to no-scroll-through means you can do it for specifically those widgets where you want special behavior (and are explicitly testing for it).

yeah I am leaning in that direction as well. Will come back to this when I do a pass on the focus management

UkoeHB commented 3 months ago

I tried adding ScrollThrough to my button with TrackedInteraction but it doesn't seem to do anything.

eidloi commented 3 months ago

I tried adding ScrollThrough to my button with TrackedInteraction but it doesn't seem to do anything.

I think I found the issue: the query that picks these up has a filter for Changed<Scrollable>, so it only works on scroll-through Sliders. But I think setting your FocusPolicy to Pass should work

UkoeHB commented 3 months ago

I think I found the issue: the query that picks these up has a filter for Changed, so it only works on scroll-through Sliders. But I think setting your FocusPolicy to Pass should work

Nice thanks, FocusPolicy::Pass worked (ScrollThrough not necessary).