Accessibility pass, command palette actions, row detail panel, server activity, map, wall display and setup guide

Accessibility: skip link, labelled landmarks, visible focus, page-change
announcements, sortable headings as real buttons, every label tied to its
field, named row checkboxes, and text contrast raised to 4.5:1 in both themes.
Command palette: also runs actions (silence/end maintenance, theme, density,
wall display, sign out) and is a proper dialog; g-then-letter shortcuts, "/" and
"?". Row detail panel for six tables. Server Activity card, with the health
check now recording offline/back-online and disk events in the audit log. Map
page of hosts, servers, DNS names and monitors. Full-screen wall display. A
getting-started checklist on the admin dashboard.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-15 21:10:56 +02:00
1 parent f7f5e1cd41
commit 57fd4f8c52
36 files changed
+2790 -210

No files matched your search

+52
View File
@@ -0,0 +1,52 @@
import { useEffect } from "react";
const CONTROL = "input:not([type=hidden]), select, textarea";
let counter = 0;
/**
* Tabler's forms put a <label class="form-label"> beside its field without tying the two together, so a screen reader reaches
* the field and hears nothing. This ties each such label to the first field after it (inside the same block), by giving the
* field an id and the label a "for". Fields that are already labelled are left alone.
*/
function associate(label: HTMLLabelElement): void {
if (label.htmlFor || label.querySelector(CONTROL)) return;
let sibling = label.nextElementSibling as HTMLElement | null;
while (sibling && !sibling.matches("label")) {
const control = sibling.matches(CONTROL) ? sibling : sibling.querySelector<HTMLElement>(CONTROL);
if (control) {
if (!control.id) control.id = `fld-${++counter}`;
label.htmlFor = control.id;
return;
}
sibling = sibling.nextElementSibling as HTMLElement | null;
}
}
/** The tick-boxes that select rows have no text of their own; say what they are. */
function nameRowCheckboxes(root: ParentNode): void {
root.querySelectorAll<HTMLInputElement>("input[type=checkbox].form-check-input").forEach((box) => {
if (box.getAttribute("aria-label") || box.closest("label") || box.labels?.length) return;
box.setAttribute("aria-label", box.closest("thead") ? "Select all rows on this page" : "Select this row");
});
}
/** Keeps every form in the app readable to assistive technology as pages load and change, without each form doing it. */
export function useFormLabels(): void {
useEffect(() => {
let timer: ReturnType<typeof setTimeout> | null = null;
const run = () => {
timer = null;
document.querySelectorAll<HTMLLabelElement>("label.form-label").forEach(associate);
nameRowCheckboxes(document);
};
const observer = new MutationObserver(() => {
if (!timer) timer = setTimeout(run, 30);
});
observer.observe(document.body, { childList: true, subtree: true });
run();
return () => {
observer.disconnect();
if (timer) clearTimeout(timer);
};
}, []);
}
+31
View File
@@ -0,0 +1,31 @@
import { useState, type KeyboardEvent, type MouseEvent } from "react";
/**
* Makes the rows of a table open a detail panel. Spread `rowProps(item)` onto the row: a click or Enter on the row opens it, but
* a click on a button, link or tick-box inside the row does its own thing and leaves the panel alone.
*/
export function useRowDetail<T>() {
const [selected, setSelected] = useState<T | null>(null);
function rowProps(item: T) {
return {
className: "row-clickable",
tabIndex: 0,
"aria-haspopup": "dialog" as const,
onClick: (e: MouseEvent<HTMLElement>) => {
if ((e.target as HTMLElement).closest("a, button, input, select, textarea, label, summary")) return;
// The row takes the focus, so it is what the keyboard comes back to when the panel closes.
e.currentTarget.focus({ preventScroll: true });
setSelected(item);
},
onKeyDown: (e: KeyboardEvent<HTMLElement>) => {
if (e.key === "Enter" && e.target === e.currentTarget) {
e.preventDefault();
setSelected(item);
}
},
};
}
return { selected, close: () => setSelected(null), rowProps };
}
+72
View File
@@ -0,0 +1,72 @@
import { useEffect } from "react";
import { useNavigate } from "react-router-dom";
import type { CurrentUser } from "../api/client";
import { visibleNav, isGroup } from "../layout/nav";
import { GO_SHORTCUTS, SHOW_SHORTCUTS_EVENT } from "../layout/shortcuts";
/** Whether the keyboard is typing into something, in which case a letter is a letter and not a shortcut. */
function isTyping(target: EventTarget | null): boolean {
const el = target as HTMLElement | null;
if (!el || !el.tagName) return false;
return el.isContentEditable || ["INPUT", "TEXTAREA", "SELECT"].includes(el.tagName);
}
/**
* Page shortcuts for anyone signed in: "g" then a letter goes to a page they are allowed to see, "/" jumps to the table's
* search box, "?" shows the list. Ignored while typing, while a dialog is open, and with Ctrl/Alt/Cmd held (those are the
* browser's and the command palette's).
*/
export function useShortcuts(user: CurrentUser): void {
const navigate = useNavigate();
useEffect(() => {
const allowed = new Set<string>(["/", "/wall"]);
for (const entry of visibleNav(user.role)) {
if (isGroup(entry)) entry.items.forEach((i) => allowed.add(i.to));
else allowed.add(entry.to);
}
let waitingForSecondKey = false;
let timer: ReturnType<typeof setTimeout> | null = null;
const reset = () => {
waitingForSecondKey = false;
if (timer) clearTimeout(timer);
timer = null;
};
function onKeyDown(e: KeyboardEvent) {
if (e.ctrlKey || e.metaKey || e.altKey || isTyping(e.target)) return;
if (document.querySelector('[role="dialog"][aria-modal="true"]')) return;
if (waitingForSecondKey) {
reset();
const hit = GO_SHORTCUTS.find((s) => s.key === e.key.toLowerCase());
if (hit && allowed.has(hit.to)) {
e.preventDefault();
navigate(hit.to);
}
return;
}
if (e.key === "g") {
waitingForSecondKey = true;
timer = setTimeout(reset, 1200);
} else if (e.key === "?") {
e.preventDefault();
window.dispatchEvent(new Event(SHOW_SHORTCUTS_EVENT));
} else if (e.key === "/") {
const box = document.querySelector<HTMLInputElement>(".table-search input");
if (box) {
e.preventDefault();
box.focus();
box.select();
}
}
}
window.addEventListener("keydown", onKeyDown);
return () => {
window.removeEventListener("keydown", onKeyDown);
reset();
};
}, [user.role, navigate]);
}