1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 22:53:14 -04:00

Improve accessibility and testability of ComboBox (#7658)

Changed it to use labeled_by to avoid kittest finding the label when
searching for the ComboBox and also set the value so a screen reader
will know what's selected.
This commit is contained in:
Lucas Meurer
2025-11-07 13:34:18 +01:00
committed by GitHub
parent 31d313572b
commit 1e63bfd657
2 changed files with 24 additions and 8 deletions

View File

@@ -61,3 +61,17 @@ fn text_edit_rtl() {
harness.snapshot(format!("text_edit_rtl_{i}"));
}
}
#[test]
fn combobox_should_have_value() {
let harness = Harness::new_ui(|ui| {
egui::ComboBox::from_label("Select an option")
.selected_text("Option 1")
.show_ui(ui, |_ui| {});
});
assert_eq!(
harness.get_by_label("Select an option").value().as_deref(),
Some("Option 1")
);
}