Dialogs, a11y · Dialog card names its role, title and detail; prompt error reads as a label; Cancel and Close read i18n; a disabled button says so in its description

This commit is contained in:
ZacharyZhang-NY committed 2026-10-02 18:52:08 -04:00
1 parent 4580e3b075
commit 70162a7dbe
6 files changed
+39 -11

No files matched your search

+5 -1
View File
@@ -5,6 +5,7 @@ use gpui::{
};
use crate::{
i18n,
motion::Spinner,
primitives::{FocusRing, Icon, IconName},
theme::{ActiveTheme, ControlSize, IconSize, Mix, Palette, Platform, Radius, TextSize},
@@ -291,7 +292,10 @@ impl RenderOnce for Button {
})
.map(|el| {
if self.disabled {
return el.opacity(0.45).cursor_not_allowed();
return el
.aria_description(i18n::text(cx, "state.unavailable", &[]))
.opacity(0.45)
.cursor_not_allowed();
}
let el = match &self.focus {
Some(handle) => el.track_focus(handle),
+5 -1
View File
@@ -5,6 +5,7 @@ use gpui::{
use super::button::{ButtonVariant, ClickHandler, label_size, tone};
use crate::{
i18n,
primitives::{FocusRing, Icon, IconName, Tooltip},
theme::{ActiveTheme, ControlSize, Radius},
};
@@ -92,7 +93,10 @@ impl RenderOnce for IconButton {
.when_some(self.tooltip, |el, text| el.tooltip(Tooltip::text(text)))
.map(|el| {
if self.disabled {
return el.opacity(0.45).cursor_not_allowed();
return el
.aria_description(i18n::text(cx, "state.unavailable", &[]))
.opacity(0.45)
.cursor_not_allowed();
}
el.cursor_pointer()
.tab_index(0)