From 209866cc27d5627d2e937b971a1a316d18bcf2b1 Mon Sep 17 00:00:00 2001 From: HippoGamus Date: Tue, 17 Jun 2025 00:05:19 +0200 Subject: [PATCH] Fix Keyboard observer not updating SliderValue (#19661) # Objective When the `CoreSlider`s `on_change` is set to None, Keyboard input, like ArrowKeys, does not update the `SliderValue`. ## Solution Handle the missing case, like it is done for Pointer. ## Testing - Did you test these changes? Yes: core_widgets & core_widgets_observers in both examples one has to remove / comment out the setting of `CoreSlider::on_change` to test the case of `on_change` being none. - Are there any parts that need more testing? No not that I am aware of. - How can other people (reviewers) test your changes? Is there anything specific they need to know? Yes: core_widgets & core_widgets_observers in both examples one has to remove / comment out the setting of `CoreSlider::on_change` to test the case of `on_change` being none. - If relevant, what platforms did you test these changes on, and are there any important ones you can't test? I tested on linux + wayland. But it is unlikely that it would effect outcomes. --------- Co-authored-by: Alice Cecile --- crates/bevy_core_widgets/src/core_slider.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/bevy_core_widgets/src/core_slider.rs b/crates/bevy_core_widgets/src/core_slider.rs index 63a606be78..d7ab387852 100644 --- a/crates/bevy_core_widgets/src/core_slider.rs +++ b/crates/bevy_core_widgets/src/core_slider.rs @@ -394,6 +394,10 @@ fn slider_on_key_input( trigger.propagate(false); if let Some(on_change) = slider.on_change { commands.run_system_with(on_change, new_value); + } else { + commands + .entity(trigger.target()) + .insert(SliderValue(new_value)); } } }