Follow-up Automatic Directional Navigation for input focus
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
### Add automatic layer navigation support (follow-on from automatic directional navigation)
Currently, the algorithm is z-index agnostic - it treats all entities with AutoDirectionalNavigation as a flat set based purely on XY position. So overlapping windows/layers would incorrectly connect to each other.
For proper layer handling, you'd need to:
1. Query entities per-layer manually and call `auto_generate_navigation_edges()` separately for each layer, OR
2. Use manual edges to explicitly define cross-layer navigation when desired
To avoid making this PR too large, I would add automatic layer support as a future enhancement. You could:
- Filter by TabGroup component, as suggested!
- Add layer_id field to AutoDirectionalNavigation
- Use parent entity hierarchy to detect separate UI trees
Would like to know if you think it's necessary for this PR to address this, or is a follow-up PR better?
_Originally posted by @jbuehler23 in https://github.com/bevyengine/bevy/pull/21668#discussion_r2468090743_
### Enable input focs by default - based on @alice-i-cecile feedback on PR #21668
From `auto_directional_navigation` example, we should enable the input focus plugins by default:
```rust
App::new()
// Input focus is not enabled by default, so we need to add the corresponding plugins
.add_plugins((
DefaultPlugins,
InputDispatchPlugin,
DirectionalNavigationPlugin,
))
```
### Rename TabGroup to FocusGroup (per @viridia 's suggestion)
Adding additional Issues to be tracked in here as well - raised by @marcelchampagne: #21949 and #21950
Contributor guide
Research direction
Start with the auto_directional_navigation example and the discussion in PR #21668, then review the listed input-focus plugins and AutoDirectionalNavigation, TabGroup, and FocusGroup references. Before coding, confirm which follow-up is in scope: per-layer navigation, default input-focus plugins, or the TabGroup rename; done criteria are not defined in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- game-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100