diff --git a/crates/ui-story/src/picker_story.rs b/crates/ui-story/src/picker_story.rs index 6a4c8348..a7e6ec4b 100644 --- a/crates/ui-story/src/picker_story.rs +++ b/crates/ui-story/src/picker_story.rs @@ -216,16 +216,7 @@ impl Render for PickerStory { .flex_col() .items_center() .track_focus(&self.picker.focus_handle(cx)) - .child( - h_flex() - .w(px(450.)) - .occlude() - .child(self.picker.clone()) - .on_mouse_down_out(cx.listener(|this, _, cx| { - this.open = false; - cx.notify(); - })), - ), + .child(h_flex().w(px(450.)).occlude().child(self.picker.clone())), ), ) }) diff --git a/crates/ui/src/picker.rs b/crates/ui/src/picker.rs index 860cb16d..0dd7bf2b 100644 --- a/crates/ui/src/picker.rs +++ b/crates/ui/src/picker.rs @@ -524,5 +524,8 @@ impl Render for Picker { .child("No matched."), ) }) + .on_mouse_down_out(cx.listener(|_, _, cx| { + cx.dispatch_action(Box::new(Cancel)); + })) } }