fix: focus detecting in IME logic

This commit is contained in:
KENZ 2026-04-05 14:33:23 +09:00 committed by Michael Murphy
parent 1d01054993
commit 8e3672a7dd

View file

@ -2095,7 +2095,7 @@ pub fn update<'a, Message: Clone + 'static>(
return;
}
input_method::Event::Preedit(content, selection) => {
if state.is_focused.is_some() {
if state.is_focused() {
state.preedit = Some(input_method::Preedit {
content: content.to_owned(),
selection: selection.clone(),
@ -2106,7 +2106,7 @@ pub fn update<'a, Message: Clone + 'static>(
}
}
input_method::Event::Commit(text) => {
let Some(focus) = &mut state.is_focused else {
let Some(focus) = state.is_focused.as_mut().filter(|f| f.focused) else {
return;
};
let Some(on_input) = on_input else {
@ -2337,8 +2337,7 @@ fn input_method<'b>(
text_layout: Layout<'_>,
value: &Value,
) -> InputMethod<&'b str> {
if state.is_focused() {
} else {
if !state.is_focused() {
return InputMethod::Disabled;
};