diff --git a/crates/snowbound/src/sidebar.rs b/crates/snowbound/src/sidebar.rs index 53d1303651e0fa6c2f82f98cb7d7ee5bd5404ab0..743fddbe1588504d3d60c74e061bbbea01c217a1 100644 --- a/crates/snowbound/src/sidebar.rs +++ b/crates/snowbound/src/sidebar.rs @@ -766,7 +766,8 @@ impl crate::State { &mut tree, &self.notebooks, drags, - width > 0.5, + // Opening, the rows are built at once, so a rename field there takes the focus. + width > 0.5 || self.sidebar && !self.full_page, self.navigation_bar_right, ); let Tree { diff --git a/crates/snowbound/tests/replay.rs b/crates/snowbound/tests/replay.rs index c00ce5eb935ebe24f7f9e5408439ccbf07036e2f..3b4a763783268786a877db12db6ba354fdc9214e 100644 --- a/crates/snowbound/tests/replay.rs +++ b/crates/snowbound/tests/replay.rs @@ -350,3 +350,22 @@ fn a_version_copied_into_its_section_is_listed_and_found() { assert_eq!(versioned, 3, "{pages:?}"); assert!(!search_results(&found).is_empty(), "{found}"); } + +/// Rename on a section tab's menu opens the shut sidebar on a field that takes what is +/// typed over the old name at once. +#[test] +fn renaming_a_section_from_its_tab_types_into_the_sidebar_at_once() { + let scratch = Scratch::new("rename-shut-sidebar"); + let notebook = + Path::new(env!("CARGO_MANIFEST_DIR")).join("../../corpus/cross-container/candidate"); + let mut steps = vec!["move 53 53", "press right", "release right", "wait 400"]; + steps.extend(["key Down", "key Enter", "wait 400"]); + steps.extend(["type Renamed", "wait 100", "accessibility typed"]); + let [typed] = replay(&scratch, Some(¬ebook), &steps) + .try_into() + .unwrap(); + assert!( + typed.contains(r#"TextInput "Name" = "Renamed" [focused]"#), + "{typed}" + ); +}