From b3ced6106b9274e5f501dc74f64a4bd0fad31e86 Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Mon, 10 May 2021 16:00:08 -0500 Subject: [PATCH] Align widget descriptions more closely with common screen reader conventions. Note that this work isn't complete--I'll correct more cases as I add more widgets and become familiar with their structures. --- egui/src/data/output.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/egui/src/data/output.rs b/egui/src/data/output.rs index c1b79ec3..6acf9f53 100644 --- a/egui/src/data/output.rs +++ b/egui/src/data/output.rs @@ -327,7 +327,7 @@ impl WidgetInfo { } = self; // TODO: localization - let widget_name = match typ { + let widget_type = match typ { WidgetType::Hyperlink => "link", WidgetType::TextEdit => "text edit", WidgetType::Button => "button", @@ -343,20 +343,19 @@ impl WidgetInfo { WidgetType::Label | WidgetType::Other => "", }; - let mut description = widget_name.to_owned(); + let mut description = widget_type.to_owned(); if let Some(selected) = selected { if *typ == WidgetType::Checkbox { - description += " "; - description += if *selected { "checked" } else { "unchecked" }; + let state = if *selected { "checked" } else { "unchecked" }; + description = format!("{} {}", state, description); } else { description += if *selected { "selected" } else { "" }; }; } if let Some(label) = label { - description += " "; - description += label; + description = format!("{}: {}", label, description); } if let Some(edit_text) = edit_text {