diff --git a/biome.json b/biome.json index 44b819c..c72900a 100644 --- a/biome.json +++ b/biome.json @@ -34,13 +34,6 @@ }, "correctness": { "useExhaustiveDependencies": "off" - }, - "a11y": { - "useAriaPropsSupportedByRole": "warn", - "noStaticElementInteractions": "warn", - "useKeyWithClickEvents": "warn", - "useSemanticElements": "warn", - "noSvgWithoutTitle": "warn" } } }, diff --git a/src/components/ConsolePanel.tsx b/src/components/ConsolePanel.tsx index 415fb3a..f98fb78 100644 --- a/src/components/ConsolePanel.tsx +++ b/src/components/ConsolePanel.tsx @@ -118,7 +118,8 @@ export function ConsolePanel({ "size-2 rounded-full", error ? "bg-red-500" : live ? "bg-emerald-500" : "bg-muted-foreground/60", )} - aria-label={error ? "Error" : live ? "Live" : "Paused"} + // The adjacent meta line already states Live / Paused / Disconnected. + aria-hidden="true" />
diff --git a/src/components/ExecTerminal.tsx b/src/components/ExecTerminal.tsx index 2fdef91..4793785 100644 --- a/src/components/ExecTerminal.tsx +++ b/src/components/ExecTerminal.tsx @@ -164,7 +164,9 @@ export function ExecTerminal({ ? "bg-amber-500" : "bg-red-500", )} - aria-label={statusLabel} + // The state is announced by the adjacent "{statusLabel} · {shell}" line; + // labelling the dot as well would read it out twice. + aria-hidden="true" />
@@ -200,6 +202,10 @@ export function ExecTerminal({ } > + {/* xterm renders its own focusable textarea, which is how keyboard users reach the + terminal; this only forwards stray clicks on the surrounding padding. */} + {/* biome-ignore lint/a11y/noStaticElementInteractions: focus shim, not a control */} + {/* biome-ignore lint/a11y/useKeyWithClickEvents: keyboard path is xterm's own textarea, already tabbable */}
| null const entries = Object.entries(labels || {}); if (!entries.length) return null; return ( -
+
    {entries.map(([k, v]) => ( - - {k}={v} - +
  • + + {k}={v} + +
  • ))} -
+ ); } diff --git a/src/components/ListPane.tsx b/src/components/ListPane.tsx index b4a1b12..3699b9a 100644 --- a/src/components/ListPane.tsx +++ b/src/components/ListPane.tsx @@ -1,5 +1,5 @@ import { List } from "lucide-react"; -import { type CSSProperties, forwardRef, type ReactNode } from "react"; +import { type CSSProperties, forwardRef, type ReactNode, type Ref } from "react"; import { lucideProps } from "@/components/Icon"; import { useWindowDragProps } from "@/components/TitleBarDragRegion"; import { Input } from "@/components/ui/input"; @@ -231,7 +231,7 @@ export function ListPane({ } export const ListItem = forwardRef< - HTMLDivElement, + HTMLButtonElement | HTMLDivElement, { active?: boolean; onClick?: () => void; @@ -239,29 +239,44 @@ export const ListItem = forwardRef< className?: string; } >(function ListItem({ active, onClick, children, className }, ref) { + const classes = cn( + "dh-list-item mb-0 flex w-full min-w-0 flex-col gap-0.5 rounded-lg border-0 px-2 py-1.5 text-start text-foreground", + onClick ? "cursor-pointer" : "", + active ? "dh-list-item-selected bg-muted" : "bg-transparent hover:bg-muted/60", + className, + ); + const style = { WebkitAppRegion: "no-drag" } as CSSProperties; + + // Rows without an onClick are display-only (K8sResourcesPage renders them + // that way). They previously still carried role="button" and tabIndex={0}, + // so they sat in the tab order announcing themselves as controls that did + // nothing. Render a plain div for those and a real button otherwise, which + // also gets Enter/Space handling for free instead of hand-rolling it. + if (!onClick) { + return ( +
} + className={classes} + aria-current={active ? "true" : undefined} + style={style} + data-no-drag + > + {children} +
+ ); + } + return ( -
} + type="button" onClick={onClick} - onKeyDown={(e) => { - if (!onClick) return; - if (e.key === "Enter" || e.key === " ") { - e.preventDefault(); - onClick(); - } - }} - className={cn( - "dh-list-item mb-0 flex w-full min-w-0 cursor-pointer flex-col gap-0.5 rounded-lg border-0 px-2 py-1.5 text-start text-foreground", - active ? "dh-list-item-selected bg-muted" : "bg-transparent hover:bg-muted/60", - className, - )} + className={classes} aria-current={active ? "true" : undefined} - style={{ WebkitAppRegion: "no-drag" } as CSSProperties} + style={style} data-no-drag > {children} -
+ ); }); diff --git a/src/components/RowMenu.tsx b/src/components/RowMenu.tsx index 48e6727..c31fa60 100644 --- a/src/components/RowMenu.tsx +++ b/src/components/RowMenu.tsx @@ -1,3 +1,9 @@ +// biome-ignore-all lint/a11y/noStaticElementInteractions: three sites, all correct. +// The row itself gates role, tabIndex, onKeyDown and onClick on `selectable` +// together, which the rule cannot correlate across separate ternaries. The two +// inner wrappers exist only to stop the row click reaching their children — the +// checkbox and the menu trigger are the actual controls. + import { MoreHorizontal } from "lucide-react"; import type { CSSProperties, ReactNode } from "react"; import { Button } from "@/components/ui/button"; @@ -64,7 +70,7 @@ export function RowMenu({
{ diff --git a/src/components/SegmentedControl.tsx b/src/components/SegmentedControl.tsx index 2ea4ca9..f7e93bd 100644 --- a/src/components/SegmentedControl.tsx +++ b/src/components/SegmentedControl.tsx @@ -1,3 +1,7 @@ +// biome-ignore-all lint/a11y/useSemanticElements: a set of related buttons is +// ARIA role="group"; the rule suggests
, which is for grouping form +// controls and would be wrong here. + import type { ReactNode } from "react"; import { Button } from "@/components/ui/button"; import { cn } from "@/lib/utils"; diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx index 15aae4a..2d3e8b1 100644 --- a/src/components/Sidebar.tsx +++ b/src/components/Sidebar.tsx @@ -210,6 +210,7 @@ export function Sidebar() { + {/* biome-ignore lint/a11y/useSemanticElements: a button group is ARIA role="group";
is for form controls */}
+ {/* The title attribute above is a mouse tooltip; this is the accessible name. */} + {srSummary} diff --git a/src/components/charts/LiveSparkline.tsx b/src/components/charts/LiveSparkline.tsx index d8e4670..71d06c0 100644 --- a/src/components/charts/LiveSparkline.tsx +++ b/src/components/charts/LiveSparkline.tsx @@ -145,6 +145,13 @@ export function LiveSparkline({ const n = hoverPts.length; + // Hover reveals individual samples, but a screen reader gets nothing from the + // path data — so state the series, its latest value, and its peak. + const fmt = (v: number) => (formatValue ? formatValue(v) : `${Math.round(v)}${unit}`); + const srSummary = values.length + ? `${label} sparkline. Latest ${fmt(values[values.length - 1])}, peak ${fmt(rawPeak)}, ${values.length} samples.` + : `${label} sparkline. No samples yet.`; + return (
setHover(null)} > + {srSummary} diff --git a/src/components/charts/MetricChart.tsx b/src/components/charts/MetricChart.tsx index 0dfe84a..50a7c6c 100644 --- a/src/components/charts/MetricChart.tsx +++ b/src/components/charts/MetricChart.tsx @@ -67,7 +67,13 @@ export function AreaChart({ return (
- + {/* Decorative: MetricCard renders the value as text beside this. */} +
- + {/* Decorative: the label and percentage are rendered as text alongside. */} +
States
-
+
+ Filter by state {stateOptions.map((opt) => { const id = `state-${opt.value}`; const checked = stateFilter.includes(opt.value); @@ -263,7 +264,7 @@ export function ContainersPage() {
); })} -
+
{stateFilter.length > 0 ? (