From 384e8f6e219bb458720eafa5bb971b832c057f23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Mar=C3=ADn?= <62134857+mariinkys@users.noreply.github.com> Date: Fri, 20 Feb 2026 12:06:45 +0100 Subject: [PATCH] fix(segmented_button): clear bold button text on context menu close --- src/widget/segmented_button/widget.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/widget/segmented_button/widget.rs b/src/widget/segmented_button/widget.rs index 1f009cc..0e1af1d 100644 --- a/src/widget/segmented_button/widget.rs +++ b/src/widget/segmented_button/widget.rs @@ -2073,7 +2073,7 @@ where _renderer: &Renderer, translation: Vector, ) -> Option> { - let state = tree.state.downcast_ref::(); + let state = tree.state.downcast_mut::(); let menu_state = state.menu_state.clone(); let entity = state.show_context?; @@ -2089,6 +2089,12 @@ where if !menu_state.inner.with_data(|data| data.open) { // If the menu is not open, we don't need to show it. + // We also clear the context entity and update the text + // cache so that the item is not bold when the context menu is closed + state.show_context = None; + for key in self.model.order.iter().copied() { + self.update_entity_paragraph(state, key); + } return None; } bounds.x = state.context_cursor.x;