a11y: a skip link, color-blind safe charts

i18n::SkipLink holds a Tab stop in flow at zero size, first where it
sits, and while focused raises a pill over the page; Enter, Space or a
press hands focus to its target. gpui orders stops by tab_index before
paint and registers none for an invisible element, so the stop stays in
flow and only the pill is raised. Theme::set_color_blind_safe swaps Ely's
chart hues for a set fitted to stay apart under Machado's protanopia,
deuteranopia and tritanopia; a test holds every pair 0.10 apart in Oklab
and each hue 3:1 on its page, and red against green shows the measure
bites. KeyboardNavigationHelper points to interaction::RovingFocus. The
announcer, labels and screen-reader text stay blocked: gpui 0.2.2 has no
accessibility tree, and nothing here is trusted to observe VoiceOver.
The i18n tests move under src/i18n/tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-09-27 20:00:26 -04:00
1 parent ff8f4ba84f
commit 6265afbb01
10 files changed
+463 -7

No files matched your search

+19 -2
View File
@@ -62,6 +62,7 @@ impl From<WindowAppearance> for Mode {
pub struct Theme {
mode: Mode,
high_contrast: bool,
color_blind_safe: bool,
transition: u64,
custom: [Option<Palette>; 2],
pub colors: Palette,
@@ -91,6 +92,7 @@ impl Theme {
cx.set_global(Theme {
mode: Mode::Light,
high_contrast: false,
color_blind_safe: false,
transition: 0,
custom: [None, None],
colors: Palette::light(false),
@@ -112,6 +114,10 @@ impl Theme {
self.high_contrast
}
pub fn color_blind_safe(&self) -> bool {
self.color_blind_safe
}
pub fn is_dark(&self) -> bool {
self.mode == Mode::Dark
}
@@ -129,7 +135,14 @@ impl Theme {
Self::fade_to_target(cx);
}
/// The owner's palette for `mode`, as an edited or imported theme gives, or none to bring Ely's back. The colors fade to it when `mode` shows. High contrast strengthens Ely's own palettes alone.
/// Chart hues that stay apart for color-blind eyes, in Ely's own palettes.
pub fn set_color_blind_safe(on: bool, cx: &mut App) {
log::info!("theme: color-blind safe charts -> {on}");
cx.global_mut::<Theme>().color_blind_safe = on;
Self::fade_to_target(cx);
}
/// The owner's palette for `mode`, as an edited or imported theme gives, or none to bring Ely's back. The colors fade to it when `mode` shows. High contrast and color-blind safe charts change Ely's own palettes alone.
pub fn set_palette(mode: Mode, palette: Option<Palette>, cx: &mut App) {
log::info!(
"theme: {mode:?} palette -> {}",
@@ -158,10 +171,14 @@ impl Theme {
if let Some(palette) = &self.custom[self.mode as usize] {
return palette.clone();
}
match self.mode {
let mut palette = match self.mode {
Mode::Light => Palette::light(self.high_contrast),
Mode::Dark => Palette::dark(self.high_contrast),
};
if self.color_blind_safe {
palette.chart = palette::color_blind_chart(self.mode);
}
palette
}
fn fade_to_target(cx: &mut App) {