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:
1 parent
ff8f4ba84f
commit
6265afbb01
10 files changed
+463
-7
No files matched your search
@@ -1,5 +1,7 @@
|
||||
use gpui::{Hsla, Rgba, rgb, rgba};
|
||||
|
||||
use super::Mode;
|
||||
|
||||
pub trait Mix {
|
||||
fn mix(&self, to: &Self, t: f32) -> Self;
|
||||
}
|
||||
@@ -142,6 +144,18 @@ pub const HUE_NAMES: [&str; 8] = [
|
||||
"Blue", "Teal", "Ochre", "Rose", "Violet", "Green", "Rust", "Cyan",
|
||||
];
|
||||
|
||||
/// Chart hues each 3:1 on its mode's page that stay apart for protanopia, deuteranopia and tritanopia; `HUE_NAMES` still name them.
|
||||
pub(crate) fn color_blind_chart(mode: Mode) -> [Hsla; 8] {
|
||||
match mode {
|
||||
Mode::Light => c8([
|
||||
0x0240b1, 0x08a399, 0xcd8017, 0x844954, 0xa276e3, 0x184606, 0xb84f10, 0x20789d,
|
||||
]),
|
||||
Mode::Dark => c8([
|
||||
0x3471e3, 0x57b6b2, 0xf6a537, 0xde545a, 0x695a91, 0xc4ecb7, 0xa93d0e, 0x52dafe,
|
||||
]),
|
||||
}
|
||||
}
|
||||
|
||||
impl Palette {
|
||||
/// The chart color at `hue`; a hue past the chart fails, naming `owner`.
|
||||
pub fn hue(&self, hue: usize, owner: impl std::fmt::Display) -> Hsla {
|
||||
|
||||
Reference in new issue
Block a user