bevyengine/bevy · info · DirectionalNavigationError
Navigation explicitly blocked from {current_focus} in the {d
Error message
Navigation explicitly blocked from {current_focus} in the {direction:?} direction. What it means
The focused entity has an explicit block for the requested direction in the DirectionalNavigationMap, added via block_edge or block_symmetrical_edge. This is deliberate denial, distinct from NoNeighborInDirection: a block exists and navigation was intentionally forbidden.
Source
Thrown at crates/bevy_input_focus/src/directional_navigation.rs:451
}
}
/// An error that can occur when navigating between focusable entities using [directional navigation](crate::directional_navigation).
#[derive(Debug, PartialEq, Clone, Error)]
pub enum DirectionalNavigationError {
/// No focusable entity is currently set.
#[error("No focusable entity is currently set.")]
NoFocus,
/// No neighbor in the requested direction.
#[error("No neighbor from {current_focus} in the {direction:?} direction.")]
NoNeighborInDirection {
/// The entity that was the focus when the error occurred.
current_focus: Entity,
/// The direction in which the navigation was attempted.
direction: CompassOctant,
},
/// Navigation explicitly blocked in the requested direction.
#[error("Navigation explicitly blocked from {current_focus} in the {direction:?} direction.")]
BlockedNavigation {
/// The entity that was the focus when the error occurred.
current_focus: Entity,
/// The direction in which the navigation was attempted.
direction: CompassOctant,
},
}
/// A focusable area with position and size information.
///
/// This struct represents a UI element used during directional navigation,
/// containing its entity ID, center position, and size for spatial navigation calculations.
///
/// The term "focusable area" avoids confusion with UI `Node` components in `bevy_ui`.
#[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(
feature = "bevy_reflect",
derive(Reflect),View on GitHub (pinned to 396ca72708)
Solutions
- If blocking is intended, handle the error silently or give feedback (sound, shake) — do nothing to focus.
- Remove the block_edge/block_symmetrical_edge call if navigation should be allowed.
- Remember that blocking a cardinal direction (e.g. North) does not block its diagonals (NorthEast/NorthWest); block those explicitly too.
Example fix
// before
nav_map.block_edge(modal_root, CompassOctant::South); // then navigate(South) errors
// after: keep the block, handle it intentionally
match nav.navigate(CompassOctant::South) {
Err(DirectionalNavigationError::BlockedNavigation { .. }) => {
// play a 'denied' cue; focus stays put
}
_ => {}
} Defensive patterns
Strategy: fallback
Validate before calling
use bevy_input_focus::directional_navigation::DirectionalNavigationMap;
fn is_blocked(map: &DirectionalNavigationMap, focus: Entity, dir: CompassOctant) -> bool {
map.get_neighbors(focus)
.map(|n| n.get(dir).is_blocked())
.unwrap_or(false)
} Try / catch
match nav.navigate(dir) {
Err(DirectionalNavigationError::BlockedNavigation { .. }) => {
// intentional: play a denied cue, focus stays
}
_ => {}
} Prevention
- Track where you call block_edge/block_symmetrical_edge so blocks are deliberate.
- Block diagonals too when blocking a cardinal direction.
- Keep blocked-direction handling distinct from no-neighbor handling in your input code.
When it happens
Trigger: Calling navigate in a direction for which block_edge/block_symmetrical_edge was previously called on the currently focused entity.
Common situations: Modal dialogs blocking navigation away from the dialog; intentional one-way menus; a block added during prototyping and forgotten.
Related errors
- No focusable entity is currently set.
- No neighbor from {current_focus} in the {direction:?} direct
- No tab groups found
- No focusable entities found
- Failed to navigate to next focusable entity
AI-assisted analysis of bevyengine/bevy@396ca72708 (2026-08-20).
Data as JSON: /api/errors/c74072cd112f8531.
Report an issue: GitHub.