From 5ccdba41af15404605c773572142d5e3ed21f10a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Wed, 22 Oct 2025 05:35:34 +0200 Subject: [PATCH] Call dropdown item's display_title() method also for rendering within the dropdown when open (#1410) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Stephan Aßmus --- crates/ui/src/dropdown.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/ui/src/dropdown.rs b/crates/ui/src/dropdown.rs index bc7f0482..ec0aac3a 100644 --- a/crates/ui/src/dropdown.rs +++ b/crates/ui/src/dropdown.rs @@ -195,10 +195,16 @@ where .map_or(Size::Medium, |dropdown| dropdown.read(cx).size); if let Some(item) = self.delegate.item(ix) { + let content = item.display_title().unwrap_or_else(|| { + div() + .whitespace_nowrap() + .child(item.title().to_string()) + .into_any_element() + }); let list_item = DropdownListItem::new(ix.row) .selected(selected) .with_size(size) - .child(div().whitespace_nowrap().child(item.title().to_string())); + .child(content); Some(list_item) } else { None