Skip to content

Follow-up Automatic Directional Navigation for input focus #21679

@jbuehler23

Description

@jbuehler23

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 #21668 (comment)

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:

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-UIGraphical user interfaces, styles, layouts, and widgetsC-FeatureA new feature, making something new possibleS-BlockedThis cannot move forward until something else changes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions