Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Ensure the outer `ListItem` element has a unique ID (#3644)

Marshall Bowersceede28fabef
diff --git a/crates/ui2/src/components/list/list_item.rs b/crates/ui2/src/components/list/list_item.rs
index 8806112dedc..481d96d242e 100644
--- a/crates/ui2/src/components/list/list_item.rs
+++ b/crates/ui2/src/components/list/list_item.rs
@@ -128,7 +128,7 @@ impl RenderOnce for ListItem {
fn render(self, cx: &mut WindowContext) -> Self::Rendered {
h_stack()
- .id("item_container")
+ .id(self.id)
.w_full()
.relative()
// When an item is inset draw the indent spacing outside of the item
@@ -151,7 +151,7 @@ impl RenderOnce for ListItem {
})
.child(
h_stack()
- .id(self.id)
+ .id("inner_list_item")
.w_full()
.relative()
.gap_1()
diff --git a/crates/ui2/src/components/stories/list_item.rs b/crates/ui2/src/components/stories/list_item.rs
index fbcea44b579..b070be663e8 100644
--- a/crates/ui2/src/components/stories/list_item.rs
+++ b/crates/ui2/src/components/stories/list_item.rs
@@ -17,7 +17,7 @@ impl Render for ListItemStory {
.child(ListItem::new("hello_world").child("Hello, world!"))
.child(Story::label("Inset"))
.child(
- ListItem::new("hello_world")
+ ListItem::new("inset_list_item")
.inset(true)
.start_slot(
IconElement::new(Icon::Bell)
@@ -59,7 +59,7 @@ impl Render for ListItemStory {
)
.child(Story::label("With end hover slot"))
.child(
- ListItem::new("with_left_avatar")
+ ListItem::new("with_end_hover_slot")
.child("Hello, world!")
.end_slot(
h_stack()