diff --git a/crates/ui2/src/components/list.rs b/crates/ui2/src/components/list.rs index 61ed483cd86eed013c46f662dd3fab4cb61f03b1..f3e75f272dcbe14b59df0eb790881c153db5f933 100644 --- a/crates/ui2/src/components/list.rs +++ b/crates/ui2/src/components/list.rs @@ -316,21 +316,7 @@ impl RenderOnce for ListItem { .relative() .child(disclosure_control(self.toggle, self.on_toggle)) .children(left_content) - .children(self.children) - // HACK: We need to attach the `on_click` handler to the child element in order to have the click - // event actually fire. - // Once this is fixed in GPUI we can remove this and rely on the `on_click` handler set above on the - // outer `div`. - .id("on_click_hack") - .when_some(self.on_click, |this, on_click| { - this.on_click(move |event, cx| { - // HACK: GPUI currently fires `on_click` with any mouse button, - // but we only care about the left button. - if event.down.button == MouseButton::Left { - (on_click)(event, cx) - } - }) - }), + .children(self.children), ) } } diff --git a/crates/ui2/src/components/stories/list_item.rs b/crates/ui2/src/components/stories/list_item.rs index 38359dbd5efd1069daf684356cd89210161a4fa2..f6f00007f1907b69d76bcf892d9eb53920913212 100644 --- a/crates/ui2/src/components/stories/list_item.rs +++ b/crates/ui2/src/components/stories/list_item.rs @@ -24,11 +24,11 @@ impl Render for ListItemStory { ) .child(Story::label("With `on_secondary_mouse_down`")) .child( - ListItem::new("with_on_secondary_mouse_down").on_secondary_mouse_down( - |_event, _cx| { + ListItem::new("with_on_secondary_mouse_down") + .child("Right click me") + .on_secondary_mouse_down(|_event, _cx| { println!("Right mouse down!"); - }, - ), + }), ) } }