From 1f7df2dd4d9f8021ce7472017fbc707311edc6d2 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Sun, 22 Nov 2026 08:03:00 +0700 Subject: [PATCH] ui-widgets: a click on a field's link label is the click its output reports to a story NumberFieldOutput and LinkedOutput reported the link click to the host but not in their story facts, so the suite saw an AccessKit Click on a link label do nothing. The Field story passes its field's link click on. --- crates/ui-widgets/src/form/stories.rs | 9 ++++++--- crates/ui-widgets/src/text/linked.rs | 3 ++- crates/ui-widgets/src/text/number/value.rs | 3 ++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/crates/ui-widgets/src/form/stories.rs b/crates/ui-widgets/src/form/stories.rs index 217500c7c..cf52f2059 100644 --- a/crates/ui-widgets/src/form/stories.rs +++ b/crates/ui-widgets/src/form/stories.rs @@ -40,10 +40,13 @@ fn field_long_text(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { /// A number field whose side label is a link: a click reports to the host and leaves focus alone, a drag scrubs. #[story(Field, covers = [], drive = Drive::Never)] fn field_link_label(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { - Field::new("Opacity") + let shown = Field::new("Opacity") .side(SideLabel::new().link().scrub(true)) - .show(ui, |ui, _| NumberField::new("Opacity", data.bind("link", Some(100.0))).scrub_by_label().show(ui)) - .into() + .show(ui, |ui, _| NumberField::new("Opacity", data.bind("link", Some(100.0))).scrub_by_label().show(ui)); + // The field the label names reports the link click; the story is its host. + let link = shown.inner.as_ref().is_some_and(|field| field.link); + let facts = StoryOutput::from(shown); + StoryOutput { clicked: facts.clicked || link, ..facts } } /// A glyph label: the icon shows, the text only names the control. diff --git a/crates/ui-widgets/src/text/linked.rs b/crates/ui-widgets/src/text/linked.rs index 477a5880c..4522ec63c 100644 --- a/crates/ui-widgets/src/text/linked.rs +++ b/crates/ui-widgets/src/text/linked.rs @@ -113,7 +113,8 @@ impl Outcome for LinkedOutput { #[cfg(feature = "testing")] fn story_facts(&self) -> crate::testing::StoryOutput { - self.edit.story_facts() + let facts = self.edit.story_facts(); + crate::testing::StoryOutput { clicked: facts.clicked || self.caption_link.is_some(), ..facts } } } diff --git a/crates/ui-widgets/src/text/number/value.rs b/crates/ui-widgets/src/text/number/value.rs index 6c4026edd..6c2755ec5 100644 --- a/crates/ui-widgets/src/text/number/value.rs +++ b/crates/ui-widgets/src/text/number/value.rs @@ -180,6 +180,7 @@ impl Outcome for NumberOutput { #[cfg(feature = "testing")] fn story_facts(&self) -> crate::testing::StoryOutput { - self.edit.story_facts() + let facts = self.edit.story_facts(); + crate::testing::StoryOutput { clicked: facts.clicked || self.link, ..facts } } }