From a8d2d7cd90d830c0e78aab1301d2f4ae8e0f8bf7 Mon Sep 17 00:00:00 2001 From: Khawar Zamman Wani Date: Mon, 26 Oct 2026 11:57:46 +0530 Subject: [PATCH] Type tool IME test: the font field is its own text input --- crates/ui-egui/src/type_tool.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/crates/ui-egui/src/type_tool.rs b/crates/ui-egui/src/type_tool.rs index a3c75c06f7..ea0b384838 100644 --- a/crates/ui-egui/src/type_tool.rs +++ b/crates/ui-egui/src/type_tool.rs @@ -5757,12 +5757,16 @@ mod ime_tests { photocraft_engine::prefs::FontPreview::Medium, &[], ); - let search = ui.scope_id().with(("font-search", "reset-font")); - state.search = ui.data(|d| d.get_temp::(search)).unwrap_or_default(); - let input = search.with("input"); - state.search_input = Some(input); - state.search_focused = ui.memory(|m| m.has_focus(input)); - state.search_height = ui.data(|d| d.get_temp::(search.with("height"))); + // The font field is its own text input: it takes focus as a click would, and + // its edit state holds what is typed and the measured popup height. + if !ui.memory(|m| m.has_focus(button)) { + ui.memory_mut(|m| m.request_focus(button)); + } + let edit = ui.data(|d| d.get_temp::(button.with("edit"))); + state.search = edit.as_ref().map(|e| e.text.clone()).unwrap_or_default(); + state.search_input = Some(button); + state.search_focused = ui.memory(|m| m.has_focus(button)); + state.search_height = edit.and_then(|e| e.menu_height); }); } if state.picker_button {