From 2937f4edf00e951994658fb02d11c9c031c2d631 Mon Sep 17 00:00:00 2001 From: poli0981 <127664709+poli0981@users.noreply.github.com> Date: Sun, 26 Jul 2026 13:33:00 +0700 Subject: [PATCH] fix(a11y): contrast, focus ring, radiogroup keys, live region and document language MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Five findings from the Phase 4 adversarial review, all of them things a green build cannot see. tokens.css redefined --accent in both dark blocks but never --accent-fg, so dark mode painted white on #8b6dff -- 3.67:1, under the 4.5:1 docs/06 §5 requires. That hit the ThemeToggle's selected chip and every primary button. Dark ink on the same violet measures 4.84:1. ThemeToggle's `overflow: hidden` clipped the global :focus-visible ring, which base.css draws at outline-offset: 2px, i.e. entirely outside the clip region. The theme control had no keyboard focus indicator at all. Corner rounding is per-child now and the ring is inset. ThemeToggle also claimed role="radiogroup"/"radio" while implementing neither roving tabindex nor arrow keys, so a screen reader announced "radio button, 1 of 3", switched to forms mode, and then the arrows did nothing while all three stayed separate tab stops -- the inverse of the pattern (WCAG 4.1.2). Arrow/Home/End now work and only the selected radio is a tab stop. The handler sits on the radios, not the group: a keydown handler on a non-focusable container never fires. Toast built its role="status" region and its text in one DOM insertion. Screen readers derive announcements from mutations to a region that was ALREADY present, so success toasts were never announced. Two permanently-mounted regions now, polite and assertive, with only their text changing -- two rather than one with a swapped aria-live, because changing politeness at runtime is not reliably picked up. applyLocale never touched , and both entrypoints ship lang="en", so a screen reader read Vietnamese and Japanese with an English voice. It also fixes the toast's dismiss button, which was labelled "Cancel" -- there is nothing to call off, the operation already finished. Also routes the last three hardcoded English aria-labels ("Sections", "Preview" x2) through the dictionary. They date from Phase 2, but full EN/VI/JA coverage is this phase's exit criterion. Co-Authored-By: Claude Opus 5 --- src/lib/components/ImportTab.svelte | 2 +- src/lib/components/TabBar.svelte | 2 +- src/lib/components/ThemeToggle.svelte | 59 ++++++++++++++++++++++++++- src/lib/components/Toast.svelte | 36 ++++++++++++++-- src/lib/components/TreePreview.svelte | 3 +- src/lib/i18n/locales/en.ts | 5 +++ src/lib/i18n/locales/ja.ts | 3 ++ src/lib/i18n/locales/vi.ts | 3 ++ src/lib/stores/settings.svelte.ts | 17 +++++++- src/styles/tokens.css | 6 +++ tests/unit/stores/settings.test.ts | 12 ++++++ 11 files changed, 138 insertions(+), 10 deletions(-) diff --git a/src/lib/components/ImportTab.svelte b/src/lib/components/ImportTab.svelte index 0a63b66..f71c3c9 100644 --- a/src/lib/components/ImportTab.svelte +++ b/src/lib/components/ImportTab.svelte @@ -143,7 +143,7 @@

{t('import.reading', { name: session.filename })}

{:else if session.kind === 'parsed'}
-
+
diff --git a/src/lib/components/TabBar.svelte b/src/lib/components/TabBar.svelte index 07646f6..d7d9782 100644 --- a/src/lib/components/TabBar.svelte +++ b/src/lib/components/TabBar.svelte @@ -25,7 +25,7 @@ ]; -