Skip to content

Commit

Permalink
Make InputFocus optional in bevy_winit
Browse files Browse the repository at this point in the history
  • Loading branch information
IceSentry committed Jan 14, 2025
1 parent 0222b35 commit 3413981
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/bevy_winit/src/accessibility.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ fn should_update_accessibility_nodes(

fn update_accessibility_nodes(
mut adapters: NonSendMut<AccessKitAdapters>,
focus: Res<InputFocus>,
focus: Option<Res<InputFocus>>,
primary_window: Query<(Entity, &Window), With<PrimaryWindow>>,
nodes: Query<(
Entity,
Expand All @@ -197,6 +197,9 @@ fn update_accessibility_nodes(
let Some(adapter) = adapters.get_mut(&primary_window_id) else {
return;
};
let Some(focus) = focus else {
return;
};
if focus.is_changed() || !nodes.is_empty() {
// Don't panic if the focused entity does not currently exist
// It's probably waiting to be spawned
Expand Down

0 comments on commit 3413981

Please sign in to comment.