feat(a11y): expose Settings navigation and file-tree rows; title the Settings window

Settings sections are tabs with their names and selected state, file-tree
rows are tree items named by file with selection and expansion, and the
Settings window carries a title for VoiceOver and the Window menu.
This commit is contained in:
l0ng-ai
2026-09-30 02:19:08 +08:00
parent 8f044924ab
commit 8efbbc4a38
7 changed files with 18 additions and 0 deletions
+8
View File
@@ -2008,6 +2008,14 @@ impl Tty7App {
});
let row_el = h_flex()
.id(SharedString::from(format!("tree-{}", path.display())))
.role(gpui::Role::TreeItem)
.aria_label(SharedString::from(
path.file_name()
.map(|n| n.to_string_lossy().into_owned())
.unwrap_or_else(|| path.display().to_string()),
))
.aria_selected(selected)
.when(is_dir, |r| r.aria_expanded(row.expanded))
.items_center()
.gap(px(TREE_GAP))
.h(px(TREE_ROW_H))
+1
View File
@@ -266,6 +266,7 @@ pub fn translate_en(key: L10nKey) -> &'static str {
L10nKey::SettingsNavKeybindings => "Keyboard shortcuts",
L10nKey::SettingsNavAbout => "About",
L10nKey::SettingsHeader => "SETTINGS",
L10nKey::SettingsWindowTitle => "Settings",
L10nKey::Reset => "Reset",
L10nKey::Save => "Save",
L10nKey::Connect => "Connect",
+1
View File
@@ -283,6 +283,7 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
L10nKey::SettingsNavKeybindings => "キーボードショートカット",
L10nKey::SettingsNavAbout => "情報",
L10nKey::SettingsHeader => "設定",
L10nKey::SettingsWindowTitle => "設定",
L10nKey::Reset => "リセット",
L10nKey::Save => "保存",
L10nKey::Connect => "接続",
+1
View File
@@ -292,6 +292,7 @@ l10n_keys! {
SettingsNavKeybindings,
SettingsNavAbout,
SettingsHeader,
SettingsWindowTitle,
Reset,
Save,
Connect,
+1
View File
@@ -239,6 +239,7 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> {
L10nKey::SettingsNavKeybindings => "快捷键",
L10nKey::SettingsNavAbout => "关于",
L10nKey::SettingsHeader => "设置",
L10nKey::SettingsWindowTitle => "设置",
L10nKey::Reset => "重置",
L10nKey::Save => "保存",
L10nKey::Connect => "连接",
+3
View File
@@ -1140,6 +1140,9 @@ impl Tty7App {
"settings-nav-{}",
target.profile_label()
)))
.role(gpui::Role::Tab)
.aria_label(t(target.title()))
.aria_selected(active)
.h(px(28.))
.px(px(8.))
.gap(px(10.))
+3
View File
@@ -30,6 +30,9 @@ pub(crate) fn window_options(cx: &mut App) -> WindowOptions {
))),
app_id: Some("tty7".to_owned()),
titlebar: Some(TitlebarOptions {
// Not drawn (the title bar is the window's own), but it is the
// name the Window menu, Mission Control and VoiceOver give it.
title: Some(crate::ui::i18n::t(crate::ui::i18n::L10nKey::SettingsWindowTitle).into()),
traffic_light_position: Some(crate::ui::theme::traffic_light_position()),
..TitleBar::title_bar_options()
}),