mirror of
https://github.com/storytold/craft-libs.git
synced 2026-12-01 02:36:54 +01:00
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 <noreply@anthropic.com>
This commit is contained in:
1 parent
6aded003af
commit
1a55a2f92c
2 files changed
+4
-2
No files matched your search
@@ -809,7 +809,8 @@ pub(super) fn initial_focus(state: &mut State, frame: u64) -> Vec<Act> {
|
||||
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,
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user