From 53b04dc561a0ec31f15b70055793127c7a109d00 Mon Sep 17 00:00:00 2001 From: Duncan Tourolle Date: Sun, 30 Aug 2026 10:31:01 +0200 Subject: [PATCH] Let the accessibility test see a callback that takes an argument MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `sets()` recognised `name:` and `name =>` and not `name(arg) =>`, which is how Slint writes a callback handler with a parameter. There is exactly one of those among the properties asserted — `accessible-action-set-value`, the action a screen reader uses to type a number into a slider — so the test reported `SliderTrack` as missing the action it declares four lines above. A false alarm rather than a false pass, and the less dangerous of the two. It is still worth fixing rather than dropping the assertion: set-value is the action that makes a slider reachable without dragging, which is most of what the actions were added for. Co-Authored-By: Claude Opus 5 (1M context) --- ui/dr-ui/tests/ui_controls_are_accessible.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ui/dr-ui/tests/ui_controls_are_accessible.rs b/ui/dr-ui/tests/ui_controls_are_accessible.rs index 15d7ada..44141bf 100644 --- a/ui/dr-ui/tests/ui_controls_are_accessible.rs +++ b/ui/dr-ui/tests/ui_controls_are_accessible.rs @@ -180,7 +180,13 @@ fn line_offsets(source: &str) -> impl Iterator { } /// Whether a block sets a property — the name at the start of a line, followed -/// by `:` for a property or `=>` for a callback. +/// by what Slint puts after a name it is binding to. +/// +/// Three forms, and the third is easy to forget: `name:` for a property, +/// `name =>` for a callback, and `name(arg) =>` for a callback that takes one. +/// `accessible-action-set-value` is the only member of the third group here and +/// leaving it out made this test report the slider as missing the very action +/// it declares. /// /// Anchored at the start of the trimmed line so that a *mention* in the prose /// above a component does not count. These files carry more comment than code, @@ -191,8 +197,10 @@ fn line_offsets(source: &str) -> impl Iterator { fn sets(block: &str, property: &str) -> bool { block.lines().any(|line| { let line = line.trim_start(); - line.strip_prefix(property) - .is_some_and(|rest| rest.starts_with(':') || rest.trim_start().starts_with("=>")) + line.strip_prefix(property).is_some_and(|rest| { + let rest = rest.trim_start(); + rest.starts_with(':') || rest.starts_with("=>") || rest.starts_with('(') + }) }) }