Accessibility sweep: colours, links, targets and names

An axe-core check of 37 pages in both themes found and fixed low-contrast text
in the status colours (light) and tabs, pills and the info alert (dark),
in-sentence links with no underline, link targets under 24 px, selects with no
name and map nodes whose name did not start with their text. docs/ACCESSIBILITY.md
says what was found and how to run the check again.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-11-10 21:52:00 +01:00
1 parent 461219844b
commit 12e9fee7af
9 files changed
+239 -5

No files matched your search

+2 -2
View File
@@ -464,7 +464,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
placeholder="Search alerts…"
filters={
<>
<select className="form-select form-select-sm w-auto" value={severity} onChange={(e) => setSeverity(e.target.value as "all" | AlertSeverity)}>
<select className="form-select form-select-sm w-auto" aria-label="Severity" value={severity} onChange={(e) => setSeverity(e.target.value as "all" | AlertSeverity)}>
<option value="all">All severities</option>
<option value="critical">Critical</option>
<option value="warning">Warning</option>
@@ -477,7 +477,7 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
</option>
))}
</select>
<select className="form-select form-select-sm w-auto" value={category} onChange={(e) => setCategory(e.target.value as "all" | AlertCategory)}>
<select className="form-select form-select-sm w-auto" aria-label="Kind of alert" value={category} onChange={(e) => setCategory(e.target.value as "all" | AlertCategory)}>
<option value="all">All kinds</option>
{presentCategories.map((c) => (
<option key={c} value={c}>
+1 -1
View File
@@ -88,7 +88,7 @@ function ElectricityCard({ e }: { e: Electricity }) {
{e.devices.map((d) => (
<tr key={d.id}>
<td>
<Link to={`/inventory?q=${encodeURIComponent(d.name)}`}>{d.name}</Link> <span className="text-secondary small">{d.kind}</span>
<Link to={`/inventory?q=${encodeURIComponent(d.name)}`} className="text-decoration-underline">{d.name}</Link> <span className="text-secondary small">{d.kind}</span>
</td>
<td className="text-end">{d.watts} W</td>
<td className="text-end">{d.monthly !== null ? moneyIn(d.monthly, e.currencyLabel, e.currency) : "—"}</td>
+7 -2
View File
@@ -201,7 +201,12 @@ function ConnectionsMap() {
</span>
<span className="map-label">
<span className="map-title">{n.label}</span>
{n.sub && <span className="map-sub">{n.sub}</span>}
{n.sub && (
<>
{" "}
<span className="map-sub">{n.sub}</span>
</>
)}
</span>
</>
);
@@ -212,7 +217,7 @@ function ConnectionsMap() {
onMouseLeave: () => setFocus((f) => (f === n.id ? null : f)),
onFocus: () => setFocus(n.id),
onBlur: () => setFocus((f) => (f === n.id ? null : f)),
"aria-label": `${KIND_WORD[n.kind]}: ${n.label}${n.sub ? `, ${n.sub}` : ""}, ${STATUS_WORD[n.status]}`,
"aria-label": `${n.label}${n.sub ? ` ${n.sub}` : ""}, ${KIND_WORD[n.kind]}, ${STATUS_WORD[n.status]}`,
};
return n.href ? (
<Link key={n.id} to={n.href} {...props}>
+1
View File
@@ -338,6 +338,7 @@ export default function Secrets({ user }: { user: CurrentUser }) {
filters={
<select
className="form-select form-select-sm w-auto"
aria-label="Status"
value={statusFilter}
onChange={(e) => setStatusFilter(e.target.value as typeof statusFilter)}
>
+1
View File
@@ -136,6 +136,7 @@ function People({ tabs }: { tabs: ReactNode }) {
<td style={{ maxWidth: 160 }}>
<select
className="form-select form-select-sm"
aria-label={`Role of ${u.name ?? u.email ?? "this user"}`}
value={u.role}
disabled={savingId === u.id || followGroups}
title={followGroups ? "Set from sign-in groups" : undefined}
+77
View File
@@ -2149,3 +2149,80 @@ tr.alert-row-child > td:first-child {
html[data-menu-icons="off"] .dropdown-item .menu-item-icon {
display: none;
}
/* ── Accessibility (found by an axe-core sweep of the main pages, both themes) ── */
/* Tabs that are not the one you are on, and the switch button that is: readable on the dark theme (at least 5.7:1; they were 2.8–3.7). */
[data-bs-theme="dark"] :is(.nav-tabs, .nav-pills) .nav-link:not(.active) {
color: #9ca3af;
}
:root:not([data-bs-theme="dark"]) .nav-pills .nav-link:not(.active) {
color: #5b6372;
}
[data-bs-theme="dark"] .btn.active {
color: #5aa9ff;
}
/* Tabler's green, yellow, red and blue are light enough to fail as text on white or on their own tint (1.9–4.3:1): on the light theme the text takes a darker shade of the same colour (at least 4.9:1 on white and on the tint). */
:root:not([data-bs-theme="dark"]) :is(.text-green, .badge.text-green) {
color: #17692a !important;
}
:root:not([data-bs-theme="dark"]) :is(.text-yellow, .badge.text-yellow) {
color: #8a5600 !important;
}
:root:not([data-bs-theme="dark"]) :is(.text-orange, .badge.text-orange) {
color: #a14d00 !important;
}
:root:not([data-bs-theme="dark"]) :is(.text-red, .badge.text-red) {
color: #b32d2d !important;
}
:root:not([data-bs-theme="dark"]) :is(.text-blue, .badge.text-blue) {
color: #0558a8 !important;
}
:root:not([data-bs-theme="dark"]) .badge.bg-secondary-lt.text-secondary {
color: #5b6372 !important;
}
/* Tabler's blue is too dark to read as text on the dark theme and too light on its own tint on the light one (2.7–4.3:1): the chosen pill, text in the primary colour and an outlined primary button take a shade that does (at least 5.7:1 on dark, 6:1 on light). */
[data-bs-theme="dark"] :is(.text-primary, .nav-pills .nav-link.active, .btn-outline-primary:not(:hover, :active, .active, :disabled)) {
color: #5aa9ff !important;
}
:root:not([data-bs-theme="dark"]) :is(.text-primary, .nav-pills .nav-link.active) {
color: #0558a8 !important;
}
.nav-pills .nav-link .opacity-75 {
opacity: 1 !important;
}
:root:not([data-bs-theme="dark"]) .alert-info {
color: #0558a8 !important;
}
[data-bs-theme="dark"] .alert-info {
color: #7cc0f7 !important;
}
:root:not([data-bs-theme="dark"]) .text-warning {
color: #8a5600 !important;
}
/* A link in the middle of a sentence is underlined, not only another colour (1.4.1: colour alone must not say it is one). */
:is(p, li, .small, .text-secondary, .form-hint, .page-intro) a:not(.btn, .badge, .nav-link, .dropdown-item, .page-link, .list-group-item, .list-group-item-action, .map-node, .navbar-brand, [role="tab"], .btn-link) {
text-decoration: underline;
text-underline-offset: 0.18em;
}
/* A link that is a whole line is at least 24 px tall (2.5.8: a target is not smaller than that). */
:is(li, .small) > a:only-child:not(.nav-link, .dropdown-item, .page-link, .btn, .badge, .list-group-item, .list-group-item-action) {
display: inline-block;
padding-block: 0.3rem;
}