From f4703332424eaf7d67db12ebd3ae6688f5287727 Mon Sep 17 00:00:00 2001 From: edwloef Date: Wed, 24 Sep 2025 10:30:09 +0200 Subject: [PATCH] fix combo-box text not getting cleared when clicking on selection --- widget/src/combo_box.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/widget/src/combo_box.rs b/widget/src/combo_box.rs index dd87c5a1..39fb5dfc 100644 --- a/widget/src/combo_box.rs +++ b/widget/src/combo_box.rs @@ -862,14 +862,18 @@ where menu, &filtered_options.options, hovered_option, - |x| { - tree.children[0] - .state - .downcast_mut::>( - ) - .unfocus(); + |selection| { + self.state.with_inner_mut(|state| { + state.value = String::new(); + state.filtered_options.update(self.state.options.clone()); + }); - (self.on_selected)(x) + tree.children[0] + .state + .downcast_mut::>() + .unfocus(); + + (self.on_selected)(selection) }, self.on_option_hovered.as_deref(), &self.menu_class,