From 3413981bdc309fbb4d85cd1bbfe1a29fea4e67e1 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Mon, 13 Jan 2025 21:35:29 -0500 Subject: [PATCH] Make InputFocus optional in bevy_winit --- crates/bevy_winit/src/accessibility.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/bevy_winit/src/accessibility.rs b/crates/bevy_winit/src/accessibility.rs index 8d1c5db0c4ceb..57672ec3b4932 100644 --- a/crates/bevy_winit/src/accessibility.rs +++ b/crates/bevy_winit/src/accessibility.rs @@ -181,7 +181,7 @@ fn should_update_accessibility_nodes( fn update_accessibility_nodes( mut adapters: NonSendMut, - focus: Res, + focus: Option>, primary_window: Query<(Entity, &Window), With>, nodes: Query<( Entity, @@ -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