From 6347ba2390edd72512c3030d06e2f23d185afc12 Mon Sep 17 00:00:00 2001 From: Hojjat Date: Wed, 2 Sep 2026 15:42:42 -0600 Subject: [PATCH] fix: keep content's overlays visible while showing toaster --- src/widget/toaster/widget.rs | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/widget/toaster/widget.rs b/src/widget/toaster/widget.rs index 922c1433..63c1c6a2 100644 --- a/src/widget/toaster/widget.rs +++ b/src/widget/toaster/widget.rs @@ -142,23 +142,26 @@ where viewport: &Rectangle, translation: Vector, ) -> Option> { - //TODO: this hides the overlay of the content during the toast + let (content_state, toasts_state) = state.children.split_at_mut(1); + let content = self.content.as_widget_mut().overlay( + &mut content_state[0], + layout, + renderer, + viewport, + translation, + ); if self.is_empty { - self.content.as_widget_mut().overlay( - &mut state.children[0], - layout, - renderer, - viewport, - translation, - ) - } else { - let bounds = layout.bounds(); - - Some(overlay::Element::new(Box::new(ToasterOverlay::new( - &mut state.children[1], - &mut self.toasts, - )))) + return content; } + // keep the content's overlays (e.g. popovers, menus) visible while a toast is shown + let toaster = overlay::Element::new(Box::new(ToasterOverlay::new( + &mut toasts_state[0], + &mut self.toasts, + ))); + Some(match content { + Some(content) => overlay::Group::with_children(vec![content, toaster]).overlay(), + None => toaster, + }) } fn drag_destinations(