diff --git a/crates/ui-contract/src/contract/steps/report.rs b/crates/ui-contract/src/contract/steps/report.rs index e79b121e4..71964fb61 100644 --- a/crates/ui-contract/src/contract/steps/report.rs +++ b/crates/ui-contract/src/contract/steps/report.rs @@ -183,6 +183,8 @@ fn report_access(p: &dyn ErasedPass<'_>, facts: &TypeFacts, input: &ReportIn<'_> }; if let Some(facts) = core.text_access.take().or_else(editor_record) { crate::runtime::access::text::report_text(ctx, id, &facts); + } else if let Some(editor) = &core.editor { + crate::runtime::access::text::fold_editor(ctx, editor.widget, id); } if core.member_of.is_some() && flags.contains(Flags::FOCUSED) { access::set_focus(ctx, id); diff --git a/crates/ui-contract/src/runtime/access/text.rs b/crates/ui-contract/src/runtime/access/text.rs index db1bbec91..20e24f0ec 100644 --- a/crates/ui-contract/src/runtime/access/text.rs +++ b/crates/ui-contract/src/runtime/access/text.rs @@ -86,6 +86,15 @@ pub(crate) fn exposed(ctx: &Context, widget: Id) -> bool { adapter::enabled(ctx, widget) } +/// Folds the node egui gives the focus widget `widget` of an editor part into the node of `owner`, which stands for +/// its key focus, for a pass whose editor reported no text facts (its view describes its text): the widget's bare +/// node, focusable and unnamed, never shows beside the owner's. +pub(crate) fn fold_editor(ctx: &Context, widget: Id, owner: Id) { + if exposed(ctx, widget) { + adapter::fold_widget(ctx, widget, owner); + } +} + /// Adds the text facts to the node of `owner` and fills its run nodes. The owner's node is the one node of the text: /// the widget's own node folds into it, so a component whose root edits its value through the text (a text field, a /// spin button, an editable combo box) is one node that takes focus and the text actions. Call it after the node's