UI: Insert Function lets Tab reach the category list

The search box asked for the keyboard focus every frame, so Tab moved to the
category list for one frame and the focus went back to the search box. The
dialog now gives the search box the focus once, when it opens, through the
module's take_first_focus, as the other dialogs do.

Test: insert_function_lets_tab_reach_the_category_list (the search box has
the focus and takes typing; after Tab the category list keeps it over several
frames; Space opens the list).
This commit is contained in:
prxnvt
2026-10-31 04:00:56 -04:00
parent 474472f999
commit c5a80ff791
4 changed files with 31 additions and 4 deletions
@@ -1,4 +1,4 @@
use super::show::ok_cancel;
use super::show::{ok_cancel, take_first_focus};
use super::{Dialog, Json, SheetApp, json, vec2};
/// Insert Function: search names (as the formula language spells them) and descriptions, or pick
@@ -10,7 +10,8 @@ pub(super) fn insert_function(app: &mut SheetApp, ui: &mut egui::Ui, d: &mut Dia
ui.horizontal(|ui| {
ui.label(language.tr("Search:"));
let r = ui.add(egui::TextEdit::singleline(&mut d.search).desired_width(300.0).hint_text(language.tr("e.g. lookup, average, date")));
r.request_focus();
// Once only, so Tab can move on to the category list.
take_first_focus(d, &r);
});
// A new search (typed, or set through the control channel) looks through every function, as
// Excel's does.