Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,22 @@
"trailingCommas": "all"
}
},
"linter": {
"enabled": true,
"includes": ["**", "!src/components/ui/**"],
"rules": {
"recommended": true,
"suspicious": {
"noExplicitAny": "off"
},
"style": {
"noNonNullAssertion": "off"
},
"correctness": {
"useExhaustiveDependencies": "off"
},
"a11y": {
"useAriaPropsSupportedByRole": "warn",
"noStaticElementInteractions": "warn",
"useKeyWithClickEvents": "warn",
"useSemanticElements": "warn",
"noSvgWithoutTitle": "warn"
}
}
},

Check notice on line 39 in biome.json

View workflow job for this annotation

GitHub Actions / ui

deserialize

The use of the recommended field has been deprecated, and will removed in the next major version of Biome. Use preset instead.
"assist": {
"actions": {
"source": {
Expand Down
3 changes: 2 additions & 1 deletion src/components/ConsolePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
/>
<div className="flex flex-col gap-1 min-w-0">
<span className={["dh-terminal__title", "text-sm font-medium"].join(" ")}>
Expand Down
8 changes: 7 additions & 1 deletion src/components/ExecTerminal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
/>
<div className="flex flex-col gap-1 min-w-0">
<span className={["dh-terminal__title", "text-sm font-medium"].join(" ")}>
Expand Down Expand Up @@ -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 */}
<div
ref={hostRef}
className={["dh-xterm-host", "flex-1 min-h-0"].join(" ")}
Expand Down
12 changes: 7 additions & 5 deletions src/components/InspectFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ export function LabelChips({ labels }: { labels?: Record<string, string> | null
const entries = Object.entries(labels || {});
if (!entries.length) return null;
return (
<div className="flex flex-wrap gap-1.5" aria-label="Labels">
<ul className="m-0 flex list-none flex-wrap gap-1.5 p-0" aria-label="Labels">
{entries.map(([k, v]) => (
<Badge key={k} variant="secondary" className="max-w-full truncate font-mono text-[11px]">
{k}={v}
</Badge>
<li key={k} className="max-w-full">
<Badge variant="secondary" className="max-w-full truncate font-mono text-[11px]">
{k}={v}
</Badge>
</li>
))}
</div>
</ul>
);
}
55 changes: 35 additions & 20 deletions src/components/ListPane.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -231,37 +231,52 @@ export function ListPane({
}

export const ListItem = forwardRef<
HTMLDivElement,
HTMLButtonElement | HTMLDivElement,
{
active?: boolean;
onClick?: () => void;
children: React.ReactNode;
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 (
<div
ref={ref as Ref<HTMLDivElement>}
className={classes}
aria-current={active ? "true" : undefined}
style={style}
data-no-drag
>
{children}
</div>
);
}

return (
<div
ref={ref}
role="button"
tabIndex={0}
<button
ref={ref as Ref<HTMLButtonElement>}
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}
</div>
</button>
);
});
8 changes: 7 additions & 1 deletion src/components/RowMenu.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -64,7 +70,7 @@ export function RowMenu({
<div
role={selectable ? "button" : undefined}
tabIndex={selectable ? 0 : undefined}
onClick={onSelect}
onClick={selectable ? onSelect : undefined}
onKeyDown={
selectable
? (e) => {
Expand Down
4 changes: 4 additions & 0 deletions src/components/SegmentedControl.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// biome-ignore-all lint/a11y/useSemanticElements: a set of related buttons is
// ARIA role="group"; the rule suggests <fieldset>, 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";
Expand Down
1 change: 1 addition & 0 deletions src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ export function Sidebar() {
</button>
</TipRight>

{/* biome-ignore lint/a11y/useSemanticElements: a button group is ARIA role="group"; <fieldset> is for form controls */}
<div
className="flex flex-col items-center gap-1 rounded-full bg-muted p-1"
style={noDrag}
Expand Down
5 changes: 5 additions & 0 deletions src/components/charts/ChartsPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export function RunningAreaChart({ data }: { data: { i: number; t: string; runni
}, [chartData]);

const last = chartData[chartData.length - 1];
const srSummary = `Running containers over time. Latest ${last.running} at ${last.t}, ${chartData.length} samples.`;
const stroke = scheme === "dark" ? "oklch(0.78 0.12 293)" : "oklch(0.52 0.18 293)";
const grid = scheme === "dark" ? "rgba(255,255,255,0.08)" : "rgba(0,0,0,0.08)";

Expand All @@ -104,7 +105,11 @@ export function RunningAreaChart({ data }: { data: { i: number; t: string; runni
viewBox="0 0 100 100"
preserveAspectRatio="none"
className="h-full w-full overflow-visible"
role="img"
aria-label={srSummary}
>
{/* The title attribute above is a mouse tooltip; this is the accessible name. */}
<title>{srSummary}</title>
<defs>
<linearGradient id={gradId} x1="0" y1="0" x2="0" y2="1">
<stop offset="0%" stopColor={stroke} stopOpacity={0.28} />
Expand Down
10 changes: 10 additions & 0 deletions src/components/charts/LiveSparkline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div
className={
Expand All @@ -160,9 +167,12 @@ export function LiveSparkline({
height="100%"
preserveAspectRatio="none"
className="block overflow-visible"
role="img"
aria-label={srSummary}
onPointerMove={onMove}
onPointerLeave={() => setHover(null)}
>
<title>{srSummary}</title>
<defs>
<linearGradient id={`spark-${gid}`} x1="0" y1="0" x2="0" y2="1">
<stop offset="0%" stopColor="currentColor" stopOpacity="0.32" />
Expand Down
17 changes: 15 additions & 2 deletions src/components/charts/MetricChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@ export function AreaChart({

return (
<div className="w-full text-foreground">
<svg viewBox="0 0 240 72" className="w-full h-16 overflow-visible" preserveAspectRatio="none">
{/* Decorative: MetricCard renders the value as text beside this. */}
<svg
viewBox="0 0 240 72"
className="w-full h-16 overflow-visible"
preserveAspectRatio="none"
aria-hidden="true"
>
<defs>
<linearGradient id={`areaFill-${gid}`} x1="0" y1="0" x2="0" y2="1">
<stop offset="0%" stopColor="currentColor" stopOpacity="0.28" />
Expand Down Expand Up @@ -111,7 +117,14 @@ export function RingGauge({

return (
<div className="flex items-center gap-3 text-foreground">
<svg width="84" height="84" viewBox="0 0 84 84" style={{ transform: "rotate(-90deg)" }}>
{/* Decorative: the label and percentage are rendered as text alongside. */}
<svg
width="84"
height="84"
viewBox="0 0 84 84"
style={{ transform: "rotate(-90deg)" }}
aria-hidden="true"
>
<circle
cx="42"
cy="42"
Expand Down
5 changes: 3 additions & 2 deletions src/routes/ContainersPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
import { toast } from "@/components/Toaster";
import { Button } from "@/components/ui/button";
import { Checkbox } from "@/components/ui/checkbox";
import {
Dialog,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";

Check warning on line 28 in src/routes/ContainersPage.tsx

View workflow job for this annotation

GitHub Actions / ui

lint/correctness/noUnusedImports

This import is unused.
import { DropdownMenuItem, DropdownMenuSeparator } from "@/components/ui/dropdown-menu";
import { Label } from "@/components/ui/label";
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
Expand Down Expand Up @@ -237,7 +237,8 @@
/>
<PopoverContent align="start" className="w-56 gap-2 p-3">
<div className="text-xs font-medium text-muted-foreground">States</div>
<div className="flex flex-col gap-2" role="group" aria-label="Filter by state">
<fieldset className="m-0 flex flex-col gap-2 border-0 p-0">
<legend className="sr-only">Filter by state</legend>
{stateOptions.map((opt) => {
const id = `state-${opt.value}`;
const checked = stateFilter.includes(opt.value);
Expand All @@ -263,7 +264,7 @@
</div>
);
})}
</div>
</fieldset>
{stateFilter.length > 0 ? (
<Button
size="sm"
Expand Down
Loading