Call dropdown item's display_title() method also for rendering within the dropdown when open (#1410)

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
This commit is contained in:
Stephan Aßmus 2025-10-22 05:35:34 +02:00 committed by GitHub
parent df2d6967ca
commit 5ccdba41af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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