From 1a55a2f92c2d4b6a00a16d4f1f92d45e297a81c3 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 27 Nov 2026 19:58:36 +0000 Subject: [PATCH] focus: a dialog's first-field focus passes over read-only text Initial::FirstField picked the first text stop, read-only ones included, so the presenter view (a dialog) opened with the keyboard in its read-only speaker notes and the show's arrows, Enter and Escape went to the notes. Read-only text is press-only already: Tab passes over it, and now so does a dialog's first-field focus. Co-Authored-By: Claude Opus 5.5 --- crates/ui-contract/src/runtime/focus/nav.rs | 3 ++- crates/ui-contract/src/runtime/focus/policy.rs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/ui-contract/src/runtime/focus/nav.rs b/crates/ui-contract/src/runtime/focus/nav.rs index 293d504d3f..5ebfead60f 100644 --- a/crates/ui-contract/src/runtime/focus/nav.rs +++ b/crates/ui-contract/src/runtime/focus/nav.rs @@ -809,7 +809,8 @@ pub(super) fn initial_focus(state: &mut State, frame: u64) -> Vec { let pick = match policy.initial { Initial::First => entry.as_ref(), Initial::Default => stops.iter().find(|rec| rec.stop.default).or(entry.as_ref()), - Initial::FirstField => stops.iter().find(|rec| rec.stop.text).or_else(|| stops.iter().find(|rec| rec.stop.default)), + // Read-only text is press-only (Tab passes over it), so it is not the field a dialog opens on. + Initial::FirstField => stops.iter().find(|rec| rec.stop.text && !rec.stop.press_only).or_else(|| stops.iter().find(|rec| rec.stop.default)), Initial::Key(name) => stops.iter().find(|rec| rec.stop.name == Some(name)), _ => None, }; diff --git a/crates/ui-contract/src/runtime/focus/policy.rs b/crates/ui-contract/src/runtime/focus/policy.rs index 7a8acfed7c..955342f8be 100644 --- a/crates/ui-contract/src/runtime/focus/policy.rs +++ b/crates/ui-contract/src/runtime/focus/policy.rs @@ -12,7 +12,8 @@ pub enum Initial { Keep, /// The scope's first stop. First, - /// The scope's first text or number field, else its default stop, else nothing: a dialog's default. + /// The scope's first editable text or number field (read-only text is passed over), else its default stop, else + /// nothing: a dialog's default. FirstField, /// The stop registered as the default. Default,