Banner text wraps; PropertyGrid label column 104
This commit is contained in:
5 files changed
+47
-17
No files matched your search
+9
-1
@@ -19,6 +19,7 @@ pub struct Switch {
|
||||
id: ElementId,
|
||||
on: bool,
|
||||
label: Option<SharedString>,
|
||||
name: Option<SharedString>,
|
||||
disabled: bool,
|
||||
on_change: Option<OnFlag>,
|
||||
}
|
||||
@@ -29,6 +30,7 @@ impl Switch {
|
||||
id: id.into(),
|
||||
on,
|
||||
label: None,
|
||||
name: None,
|
||||
disabled: false,
|
||||
on_change: None,
|
||||
}
|
||||
@@ -39,6 +41,12 @@ impl Switch {
|
||||
self
|
||||
}
|
||||
|
||||
/// Names it for assistive technology, drawing nothing.
|
||||
pub fn name(mut self, name: impl Into<SharedString>) -> Self {
|
||||
self.name = Some(name.into());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn disabled(mut self, disabled: bool) -> Self {
|
||||
self.disabled = disabled;
|
||||
self
|
||||
@@ -121,7 +129,7 @@ impl RenderOnce for Switch {
|
||||
.id(self.id)
|
||||
.role(Role::Switch)
|
||||
.aria_toggled(self.on.into())
|
||||
.when_some(self.label.clone(), |row, label| row.aria_label(label))
|
||||
.when_some(self.label.clone().or(self.name), |row, label| row.aria_label(label))
|
||||
.when(self.disabled, |row| {
|
||||
row.aria_description(i18n::text(cx, "state.unavailable", &[]))
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user