Skip to content

Commit 747507f

Browse files
committed
A11y: Fix 18 contrast violations surfaced by the design-time checker
New `a11y-contrast` check found 18 real WCAG AA contrast failures in the codebase that the axe E2E tests never flagged (because axe only audits ~22 dialog states, while the design-time checker walks every styled element). Fixes grouped by pattern: Soft status text on same-hue tinted bg (6 selectors). `.error-message` (NetworkLoginForm), `.smb-native-note` (TransferDialog + TransferProgressDialog), `.clear-error` (DriveIndexingSection), `.port-status.warning`/`.port-status.unavailable` (McpServerSection), `.btn-danger` base color (Button). Each used the brand `--color-error` / `--color-warning` as fg on a tinted bg of the same hue — ratios 3.3–4.5. Introduce `--color-error-text` (#b91c1c light, #fca5a5 dark) and `--color-warning-text` (#9a3412 light, #fdba74 dark) in `app.css`, and switch the failing selectors to the `-text` variants. Brand-color tokens retained for non-text uses (borders, badges, icon fills). White text on warning orange (2 selectors). `.conflict-badge` (KeyboardShortcutsSection) and `.viewer-action-btn` (viewer/+page). `#ffffff` on warning orange clocked 2.03:1 in dark mode. Switch to `--color-accent-fg` (always dark — already designed for text on saturated bg, e.g. the accent-colored buttons). Accent-gold hover on white (2 selectors). `.reset-button:hover` (SettingRow) and `.appearance-link:hover` (AppearanceSection) used `--color-accent-hover` which is a lighter gold (2.06:1 on white). Keep the a11y-safe base color on hover and use `text-decoration: underline` for hover affordance instead. Timeout retry button (VolumeBreadcrumb). `.timeout-retry-button` used `--color-warning` fg; on the hover bg `--color-bg-tertiary` it dropped to 3.09:1. Switch to `--color-warning-text`. After: `./scripts/check-a11y-contrast` reports 0 violations.
1 parent a5b6a5f commit 747507f

12 files changed

Lines changed: 27 additions & 12 deletions

File tree

apps/desktop/src/app.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,14 @@
6666
--color-error: #d32f2f;
6767
--color-error-bg: #fef2f2;
6868
--color-error-border: #fecaca;
69+
/* Darker variant for text in error contexts — guarantees ≥4.5:1 on `--color-error-bg`
70+
and similar tinted bgs (the non-text `--color-error` at `#d32f2f` only reaches ~4:1). */
71+
--color-error-text: #b91c1c;
6972
--color-warning: #e65100;
7073
--color-warning-bg: rgba(230, 81, 0, 0.1);
74+
/* Same reasoning as `--color-error-text` — the brand `--color-warning` at `#e65100`
75+
clocks ~3.3:1 on the warning tint; this darker variant meets AA. */
76+
--color-warning-text: #9a3412;
7177

7278
/* Disk usage bar — solid colors mixed against the track for clean layering.
7379
* Uses color-mix against the border color (not transparent) to avoid
@@ -206,8 +212,11 @@
206212
--color-error: #f44336;
207213
--color-error-bg: #450a0a;
208214
--color-error-border: #7f1d1d;
215+
/* Light-on-dark text variant — see light-mode comment. ≥4.5:1 on `--color-error-bg`. */
216+
--color-error-text: #fca5a5;
209217
--color-warning: #f5a623;
210218
--color-warning-bg: rgba(245, 166, 35, 0.15);
219+
--color-warning-text: #fdba74;
211220

212221
/* Disk usage bar — solid colors, same mixing strategy as light mode */
213222
--color-disk-ok: color-mix(in srgb, var(--color-allow) 60%, var(--color-border));

apps/desktop/src/lib/file-explorer/navigation/VolumeBreadcrumb.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@
905905
border: none;
906906
padding: 0 var(--spacing-xs);
907907
cursor: default;
908-
color: var(--color-warning);
908+
color: var(--color-warning-text);
909909
font-size: var(--font-size-md);
910910
line-height: 1;
911911
border-radius: var(--radius-sm);

apps/desktop/src/lib/file-explorer/network/NetworkLoginForm.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@
288288
border: 1px solid var(--color-error);
289289
border-radius: var(--radius-lg);
290290
font-size: var(--font-size-sm);
291-
color: var(--color-error);
291+
color: var(--color-error-text);
292292
}
293293
294294
.error-icon {

apps/desktop/src/lib/file-operations/transfer/TransferDialog.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@
592592
margin: 0;
593593
padding: var(--spacing-xs) var(--spacing-sm);
594594
font-size: var(--font-size-xs);
595-
color: var(--color-warning);
595+
color: var(--color-warning-text);
596596
background: var(--color-warning-bg);
597597
border-radius: var(--radius-sm);
598598
}

apps/desktop/src/lib/file-operations/transfer/TransferProgressDialog.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1152,7 +1152,7 @@
11521152
margin: 0 var(--spacing-xl);
11531153
padding: var(--spacing-xs) var(--spacing-sm);
11541154
font-size: var(--font-size-xs);
1155-
color: var(--color-warning);
1155+
color: var(--color-warning-text);
11561156
background: var(--color-warning-bg);
11571157
border-radius: var(--radius-sm);
11581158
text-align: center;

apps/desktop/src/lib/settings/components/SettingRow.svelte

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,10 @@
147147
}
148148
149149
.reset-button:hover {
150-
color: var(--color-accent-hover);
150+
/* Keep the a11y-safe accent-text color on hover; add underline for visual
151+
affordance instead of switching to the lighter `--color-accent-hover`
152+
which doesn't meet 4.5:1 on white. */
153+
text-decoration: underline;
151154
}
152155
153156
.setting-label {

apps/desktop/src/lib/settings/sections/AppearanceSection.svelte

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,10 @@
263263
}
264264
265265
.appearance-link:hover {
266-
color: var(--color-accent-hover);
266+
/* Keep the a11y-safe accent-text color on hover; add underline for visual
267+
affordance instead of switching to the lighter `--color-accent-hover`
268+
which doesn't meet 4.5:1 on white. */
269+
text-decoration: underline;
267270
}
268271
269272
.date-time-setting {

apps/desktop/src/lib/settings/sections/DriveIndexingSection.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@
152152
padding: var(--spacing-xs) var(--spacing-sm);
153153
border-radius: var(--radius-sm);
154154
background: color-mix(in srgb, var(--color-error) 10%, transparent);
155-
color: var(--color-error);
155+
color: var(--color-error-text);
156156
font-size: var(--font-size-sm);
157157
}
158158
</style>

apps/desktop/src/lib/settings/sections/KeyboardShortcutsSection.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@
630630
631631
.conflict-badge {
632632
background: var(--color-warning);
633-
color: white;
633+
color: var(--color-accent-fg);
634634
font-size: var(--font-size-xs);
635635
/* stylelint-disable-next-line declaration-property-value-disallowed-list */
636636
padding: 1px 5px;

apps/desktop/src/lib/settings/sections/McpServerSection.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,12 +243,12 @@
243243
244244
.port-status.warning {
245245
background: color-mix(in srgb, var(--color-warning) 7%, transparent);
246-
color: var(--color-warning);
246+
color: var(--color-warning-text);
247247
}
248248
249249
.port-status.unavailable {
250250
background: color-mix(in srgb, var(--color-error) 7%, transparent);
251-
color: var(--color-error);
251+
color: var(--color-error-text);
252252
display: flex;
253253
align-items: center;
254254
gap: var(--spacing-sm);

0 commit comments

Comments
 (0)