From f98ad5232b23438138c48d4730bdc324070ec443 Mon Sep 17 00:00:00 2001 From: Floyd Wang Date: Fri, 29 Aug 2025 10:52:30 +0800 Subject: [PATCH] table: Fix `ESC` event not propagating to modal with selection (#1183) --- crates/ui/src/table/mod.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/ui/src/table/mod.rs b/crates/ui/src/table/mod.rs index 9a1cb300..f2745d92 100644 --- a/crates/ui/src/table/mod.rs +++ b/crates/ui/src/table/mod.rs @@ -378,8 +378,16 @@ where self.set_selected_col(col_ix, cx) } + fn has_selection(&self) -> bool { + self.selected_row.is_some() || self.selected_col.is_some() + } + fn action_cancel(&mut self, _: &Cancel, _: &mut Window, cx: &mut Context) { - self.clear_selection(cx); + if self.has_selection() { + self.clear_selection(cx); + return; + } + cx.propagate(); } fn action_select_prev(&mut self, _: &SelectPrev, _: &mut Window, cx: &mut Context) {