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.

ui: Don't add an `on_click` handler for disabled `ListItem`s (#23569)

Marshall Bowers76bf4686ef35
diff --git a/crates/ui/src/components/list/list_item.rs b/crates/ui/src/components/list/list_item.rs
index e9fb9f92432..a7efaecf919 100644
--- a/crates/ui/src/components/list/list_item.rs
+++ b/crates/ui/src/components/list/list_item.rs
@@ -245,9 +245,10 @@ impl RenderOnce for ListItem {
})
})
})
- .when_some(self.on_click, |this, on_click| {
- this.cursor_pointer().on_click(on_click)
- })
+ .when_some(
+ self.on_click.filter(|_| !self.disabled),
+ |this, on_click| this.cursor_pointer().on_click(on_click),
+ )
.when(self.outlined, |this| {
this.border_1()
.border_color(cx.theme().colors().border)