git.lucas.co / cce-designer
graphic design tool
git clone https://git.lucas.co/cce-designer.git

commitaee176d2d286bfd39dfe8e2244294134356a5885
parent20e3a8ed65
authorLucas Galante <[email protected]>
date2026-08-30 19:59
fix: Escape closes an open context menu before cancelling a connection

The node, viewport and plate-corner menus (all riding the shared
context_menu thread-local) were mouse-dismiss only: the app-level
Escape arm went straight to graph cancel_connecting and returned, so
the key never dismissed a visible menu. A visible menu now takes
Escape first; connection-cancel keeps the key otherwise.

The params-pane dropdowns' dead keyboard is fixed on the cce-ui side
(ParametersBg's choice row now claims focused_param on press,
cce-ui@db50330) - this app's dispatch order already routes the params
pane ahead of the Escape arm, so no change was needed here for that.

Co-Authored-By: Claude Fable 5 <[email protected]>

 src/app.rs | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/app.rs b/src/app.rs
index 3777670..991c5d4 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -5448,6 +5448,21 @@ pub(crate) fn geometry_to_spreadsheet_data(geom: &Geometry) -> (Vec<String>, Vec
                 }
 
                 if event.state == ElementState::Pressed && event.logical_key == Key::Named(NamedKey::Escape) {
+                    // An open context menu — node, viewport, or plate-corner,
+                    // all riding the shared context_menu thread-local — takes
+                    // Escape ahead of connection-cancel. They were
+                    // mouse-dismiss only, which left Escape wired to a
+                    // cancel_connecting the user could not see happening.
+                    if cce_ui::widget::context_menu::is_visible() {
+                        if self.node_menu_open() {
+                            self.close_node_menu();
+                        } else if self.viewport_menu_open() {
+                            self.close_viewport_menu();
+                        } else {
+                            self.close_plate_menu();
+                        }
+                        return true;
+                    }
                     self.graph_mut().cancel_connecting();
                     return true;
                 }