i18n, a11y, IME · palette copy reads i18n with builtin en/zh; dialog and palette Enter run on the field's key-down action, so an IME-kept Enter never submits; Button, IconButton, TextInput, Tabs, EditorTabs, StatusBarItem and palette rows name their role and label

This commit is contained in:
ZacharyZhang-NY committed 2026-10-02 12:58:43 -04:00
1 parent 8fd7b8ab87
commit 4580e3b075
15 files changed
+257 -75

No files matched your search

+5 -1
View File
@@ -1,6 +1,7 @@
use gpui::{
App, ClickEvent, ElementId, FocusHandle, FontWeight, Hsla, IntoElement, MouseButton,
RenderOnce, SharedString, Window, div, prelude::*, transparent_black,
RenderOnce, Role, SharedString, StatefulInteractiveElement, Window, div, prelude::*,
transparent_black,
};
use crate::{
@@ -232,6 +233,7 @@ impl RenderOnce for Button {
let platform = cx.theme().platform;
let hint = self.shortcut.map(|source| shortcut_text(&source, platform));
let spinner = (self.id.clone(), "spinner");
let name = self.label.clone();
let parts = div()
.flex()
.items_center()
@@ -251,6 +253,8 @@ impl RenderOnce for Button {
div()
.id(self.id)
.role(Role::Button)
.when(!name.is_empty(), |el| el.aria_label(name))
.flex()
.flex_none()
.items_center()
+8 -2
View File
@@ -1,6 +1,6 @@
use gpui::{
App, ClickEvent, ElementId, IntoElement, MouseButton, RenderOnce, SharedString, Window, div,
prelude::*,
App, ClickEvent, ElementId, IntoElement, MouseButton, RenderOnce, Role, SharedString, Window,
div, prelude::*,
};
use super::button::{ButtonVariant, ClickHandler, label_size, tone};
@@ -70,9 +70,15 @@ impl RenderOnce for IconButton {
let tone = tone(self.variant, &theme.colors);
let (_, icon_size) = label_size(self.size);
let side = theme.control_height(self.size);
let name: SharedString = self
.tooltip
.clone()
.unwrap_or_else(|| self.icon.name().into());
div()
.id(self.id)
.role(Role::Button)
.aria_label(name)
.flex()
.flex_none()
.items_center()