diff --git a/crates/outline/src/outline.rs b/crates/outline/src/outline.rs index 8c5e78d77bce76e62ef94d2501dbef588cd76f00..1f85d08cee850f18a30cca9b56061854f7cbc7b1 100644 --- a/crates/outline/src/outline.rs +++ b/crates/outline/src/outline.rs @@ -81,8 +81,19 @@ impl ModalView for OutlineView { } impl Render for OutlineView { - fn render(&mut self, _window: &mut Window, _cx: &mut Context) -> impl IntoElement { - v_flex().w(rems(34.)).child(self.picker.clone()) + fn render(&mut self, _window: &mut Window, cx: &mut Context) -> impl IntoElement { + v_flex() + .w(rems(34.)) + .on_action(cx.listener( + |_this: &mut OutlineView, + _: &zed_actions::outline::ToggleOutline, + _window: &mut Window, + cx: &mut Context| { + // When outline::Toggle is triggered while the outline is open, dismiss it + cx.emit(DismissEvent); + }, + )) + .child(self.picker.clone()) } }