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.
This commit is contained in:
parent
50c8310de5
commit
b3ced6106b
1 changed files with 5 additions and 6 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue