From 3333c79da15cd33895f37eda42857ff592172012 Mon Sep 17 00:00:00 2001 From: Kunall Banerjee Date: Mon, 23 Feb 2026 13:58:34 -0500 Subject: [PATCH] context_menu: Fix certain menu items not reacting to click events (#49557) Use `Workspace::for_window` instead of `window.root().flatten()`. https://github.com/user-attachments/assets/3ea6dae3-166d-49e4-9fff-8256e13cc2bf https://github.com/user-attachments/assets/eb8d9394-5f71-4df6-b0db-c1c8078f1b9a Before you mark this PR as ready for review, make sure that you have: - [x] Added a solid test coverage and/or screenshots from doing manual testing - [x] Done a self-review taking into account security and performance aspects - [x] Aligned any UI changes with the [UI checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) Release Notes: - Fixed certain context menu items not reacting to click events --- crates/agent_ui/src/agent_configuration.rs | 2 +- crates/edit_prediction_ui/src/edit_prediction_button.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/agent_ui/src/agent_configuration.rs b/crates/agent_ui/src/agent_configuration.rs index 81de185db7c8586a0db67d8da49d6f2dc59d2e8e..e667a6c1d0507f399b4339c84fec4fc7099eab4e 100644 --- a/crates/agent_ui/src/agent_configuration.rs +++ b/crates/agent_ui/src/agent_configuration.rs @@ -983,7 +983,7 @@ impl AgentConfiguration { }) .entry("Add Custom Agent", None, { move |window, cx| { - if let Some(workspace) = window.root().flatten() { + if let Some(workspace) = Workspace::for_window(window, cx) { let workspace = workspace.downgrade(); window .spawn(cx, async |cx| { diff --git a/crates/edit_prediction_ui/src/edit_prediction_button.rs b/crates/edit_prediction_ui/src/edit_prediction_button.rs index ac579d33ab42ff11a58e850639c1850c88262f74..729b901be1556f011c101258d34af9b98b45f272 100644 --- a/crates/edit_prediction_ui/src/edit_prediction_button.rs +++ b/crates/edit_prediction_ui/src/edit_prediction_button.rs @@ -993,7 +993,7 @@ impl EditPredictionButton { "Edit Prediction Menu Action", action = "configure_excluded_files", ); - if let Some(workspace) = window.root().flatten() { + if let Some(workspace) = Workspace::for_window(window, cx) { let workspace = workspace.downgrade(); window .spawn(cx, async |cx| {