From ae5bb40d6e5945d54c892cc5bcfdf9480252d9f1 Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Mon, 24 Mar 2025 03:36:49 +0100 Subject: [PATCH] fix(text_input): conflicts with keyboard focus navigation --- src/widget/text_input/input.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/widget/text_input/input.rs b/src/widget/text_input/input.rs index 52fde46..1493857 100644 --- a/src/widget/text_input/input.rs +++ b/src/widget/text_input/input.rs @@ -647,14 +647,10 @@ where }; } - if !state - .is_focused - .as_ref() - .map(|f| f.updated_at == LAST_FOCUS_UPDATE.with(|f| f.get())) - .unwrap_or_default() - { - state.unfocus(); - // state.is_read_only = true; + if let Some(f) = state.is_focused.as_ref() { + if f.updated_at != LAST_FOCUS_UPDATE.with(|f| f.get()) { + state.unfocus(); + } } self.is_read_only = state.is_read_only; @@ -1787,7 +1783,6 @@ pub fn update<'a, Message: Clone + 'static>( // Or to connect the text input to a button. shell.publish(on_tab.clone()); } else { - state.unfocus(); state.is_read_only = true; if let Some(on_unfocus) = on_unfocus {