diff --git a/crates/ui-contract/src/contract/cx/edit.rs b/crates/ui-contract/src/contract/cx/edit.rs index ca892afd1..58cab318b 100644 --- a/crates/ui-contract/src/contract/cx/edit.rs +++ b/crates/ui-contract/src/contract/cx/edit.rs @@ -245,6 +245,7 @@ impl Edit for Cx<'_, C> { response.caret = self.core.texts.as_ref().and_then(|(_, text)| text.caret()); response.unparsed = self.core.text_invalid; response.value_text = self.core.value_text.borrow().clone(); + response.hover = self.core.hover(); response.shown = match (&self.shown, self.mixed) { (_, true) => Some(Mixed::Mixed), (Some(value), false) => Some(Mixed::Same(Arc::clone(value))), diff --git a/crates/ui-contract/src/testing/suite/body.rs b/crates/ui-contract/src/testing/suite/body.rs index baf2bb189..43b6c4356 100644 --- a/crates/ui-contract/src/testing/suite/body.rs +++ b/crates/ui-contract/src/testing/suite/body.rs @@ -130,6 +130,18 @@ pub(super) fn layer_traps_focus(subject: &Subject) -> Result<(), String> { for step in 0..stops + 2 { fixture.key(Key::Tab, Modifiers::NONE); if !focus_within(&fixture, container.node) { + if story.name == "menu_with_companion" { + let tree = fixture.tree(); + let focused = tree.focused_key(); + eprintln!( + "DIAG layer_traps_focus: focused {:?} role {:?} name {:?}; container {:?} role {:?}; scope trap {traps}", + focused, + tree.role_of(focused), + crate::testing::access::name(tree, focused), + container.node, + tree.role_of(container.node) + ); + } return Err(format!("{}: Tab number {} moved focus out of the layer", story.name, step + 1)); } } diff --git a/crates/ui-widgets/src/pickers/combo_box/stories.rs b/crates/ui-widgets/src/pickers/combo_box/stories.rs index 52c304d38..9662797ee 100644 --- a/crates/ui-widgets/src/pickers/combo_box/stories.rs +++ b/crates/ui-widgets/src/pickers/combo_box/stories.rs @@ -68,9 +68,12 @@ fn hover_option(fixture: &mut Fixture) { fn combo_box_preview(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { let options = options(); let shown = ComboBox::new("Font", Bind::bound(data.value("preview_font", "Charter".to_owned())), &options).show(ui); - // The field keeps "Charter" while the hovered option is previewed; the story keeps what the preview shows. - if shown.preview != Preview::Unchanged { - *data.value("previewed", Preview::::Unchanged) = shown.preview.clone(); + // The field keeps "Charter" while the hovered option is previewed. The preview is no edit, so the story says what + // it shows in its readout, not in its data, which a drive reads as a changed value. + let output = StoryOutput::from(shown.edit); + match shown.preview { + Preview::Shows(text) => output.readout(format!("Previewing {text}")), + Preview::Ended => output.readout("Preview ended"), + _ => output, } - shown.edit.into() }