Tab navigation skips non-visible entities#24769
Conversation
23df688 to
192ebfe
Compare
| /// tab groups. | ||
| pub modal: bool, | ||
|
|
||
| /// Override global setting for only focusing entities that are visible. |
There was a problem hiding this comment.
These docs could be clearer.
| pub struct TabNavigationConfig { | ||
| /// Whether to only focus entities that are visible, globally. | ||
| /// Can be overridden per-[`TabGroup`] via [`TabGroup::focus_only_visible`]. | ||
| pub focus_only_visible: bool, |
There was a problem hiding this comment.
This should default to true IMO. Just make a migration guide entry: this is much less surprising behavior.
alice-i-cecile
left a comment
There was a problem hiding this comment.
Swap the default behavior, add a migration guide entry and do a pass on the docs and I think this will be good to go <3
|
It looks like your PR is a breaking change, but you didn't provide a migration guide. Please review the instructions for writing migration guides, then expand or revise the content in the migration guides directory to reflect your changes. |
|
Do we even need to support the old behavior? Focusing invisible entities seems broken. |
|
Also, I wonder if it should also exclude |
Yes, I was thinking the same but didn't initially want to break things for people. |
That would require a dependency on bevy_ui and like you said, the input focus is more generic. |
Fair enough. I should note that in my own work (using |
|
I'd prefer to just cut the old behavior completely. Remember to update your title / PR description :) |
|
So remove the flag and just leave the sane behavior? |
Tab navigation now skips entities that are not visible in the hierarchy. Previously, TabNavigation would focus entities regardless of their InheritedVisibility, so hidden UI elements could still receive focus when cycling with Tab. Entities without an InheritedVisibility component (non-UI entities) are still considered visible and remain focusable.
ebf2786 to
001345d
Compare
Since this is classified a bug fix now, it shouldn't need the migration guide, right? |
|
Yep :) |
Objective
In most cases invisible components should not be part of the focus cycle.
Solution
Changed the behavior of tab cycling to skip non-visible entities based on
InheritedVisiblity.Testing
Tested on a local project, you can set components in one of the existing examples with Visibility::Hidden and the cycle will skip the hidden components.