From 4ab9992bf8636937ed3b0b557f084a2d1fedfd8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Thu, 30 Jul 2020 00:52:02 +0200 Subject: [PATCH] Unfocus `TextInput` when `Escape` key is pressed --- native/src/widget/text_input.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs index 8c226d3d..9e15f4be 100644 --- a/native/src/widget/text_input.rs +++ b/native/src/widget/text_input.rs @@ -468,6 +468,11 @@ where self.state.cursor.select_all(&self.value); } } + keyboard::KeyCode::Escape => { + self.state.is_focused = false; + self.state.is_dragging = false; + self.state.is_pasting = None; + } _ => {} }, Event::Keyboard(keyboard::Event::KeyReleased {