Expand description
This module provides a framework for handling linear tab-key navigation in Bevy applications.
The rules of tabbing are derived from the HTML specification, and are as follows:
- An index >= 0 means that the entity is tabbable via sequential navigation. The order of tabbing is determined by the index, with lower indices being tabbed first. If two entities have the same index, then the order is determined by the order of the entities in the ECS hierarchy (as determined by Parent/Child).
- An index < 0 means that the entity is not focusable via sequential navigation, but can still be focused via direct selection.
Tabbable entities must be descendants of a TabGroup
entity, which is a component that
marks a tree of entities as containing tabbable elements. The order of tab groups
is determined by the TabGroup::order
field, with lower orders being tabbed first. Modal tab groups
are used for ui elements that should only tab within themselves, such as modal dialog boxes.
To enable automatic tabbing, add the
TabNavigationPlugin
and InputDispatchPlugin
to your app.
This will install a keyboard event observer on the primary window which automatically handles
tab navigation for you.
Alternatively, if you want to have more control over tab navigation, or are using an input-action-mapping framework,
you can use the [TabNavigation
] system parameter directly instead.
This object can be injected into your systems, and provides a navigate
method which can be
used to navigate between focusable entities.
Structs§
- TabGroup
- A component used to mark a tree of entities as containing tabbable elements.
- TabIndex
- A component which indicates that an entity wants to participate in tab navigation.
- TabNavigation
Plugin - Plugin for navigating between focusable entities using keyboard input.
Enums§
- NavAction
- A navigation action that users might take to navigate your user interface in a cyclic fashion.
- TabNavigation
Error - An error that can occur during tab navigation.
Functions§
- handle_
tab_ navigation - Observer function which handles tab navigation.