Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Ensure pane where search buttons are clicked is focused before dispatching action (#24037)
Ben Kunkle027fe1b4b5ea
diff --git a/crates/search/src/search_bar.rs b/crates/search/src/search_bar.rsindex 897c4c2c2bf..84fc534c2f6 100644--- a/crates/search/src/search_bar.rs+++ b/crates/search/src/search_bar.rs@@ -14,7 +14,15 @@ pub(super) fn render_nav_button(icon,).shape(IconButtonShape::Square)- .on_click(|_, window, cx| window.dispatch_action(action.boxed_clone(), cx))+ .on_click({+ let focus_handle = focus_handle.clone();+ move |_, window, cx| {+ if !focus_handle.is_focused(&window) {+ window.focus(&focus_handle);+ }+ window.dispatch_action(action.boxed_clone(), cx)+ }+ }).tooltip(move |window, cx| Tooltip::for_action_in(tooltip, action, &focus_handle, window, cx)).disabled(!active)}