feat(a11y): screen reader name and description support for button widgets
This commit is contained in:
parent
f6039597b7
commit
b9c24d2421
6 changed files with 122 additions and 19 deletions
|
|
@ -63,6 +63,10 @@ impl<Message> Button<'_, Message> {
|
|||
Self {
|
||||
id: Id::unique(),
|
||||
label: Cow::Borrowed(""),
|
||||
#[cfg(feature = "a11y")]
|
||||
name: Cow::Borrowed(""),
|
||||
#[cfg(feature = "a11y")]
|
||||
description: Cow::Borrowed(""),
|
||||
tooltip: Cow::Borrowed(""),
|
||||
on_press: None,
|
||||
width: Length::Shrink,
|
||||
|
|
@ -136,8 +140,10 @@ impl<'a, Message: Clone + 'static> From<Button<'a, Message>> for Element<'a, Mes
|
|||
#[cfg(feature = "a11y")]
|
||||
{
|
||||
if !builder.label.is_empty() {
|
||||
button = button.name(builder.label);
|
||||
button = button.name(builder.label)
|
||||
}
|
||||
|
||||
button = button.description(builder.description);
|
||||
}
|
||||
|
||||
if builder.tooltip.is_empty() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue