Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.
TypeScript browser-shellcontrol-planefile-managerhomelabmobile-firstnextjsptyreactself-hostedserver-managementshadcn-uisysadmintailwindcssterminaltypescriptvpsweb-desktopweb-terminal
fix(a11y,perf): name the dock icons, announce login errors, stop the resize storm
Rahman57ffa7aa2420
diff --git a/frontend/slices/appshell/components/dock-parts.tsx b/frontend/slices/appshell/components/dock-parts.tsxindex 14bfffb4..95080304 100644--- a/frontend/slices/appshell/components/dock-parts.tsx+++ b/frontend/slices/appshell/components/dock-parts.tsx@@ -117,6 +117,11 @@ export function DockIcon({activate();}}}+ // The icon is the only child and lucide renders no <title>, so without+ // this the link has NO accessible name — every app in the dock read as+ // a blank link. The HoverPanel that carries app.title is `invisible`,+ // i.e. out of the a11y tree. PlainIcon (below) already did this.+ aria-label={running ? `${app.title} (running)` : app.title}className="relative block size-full drop-shadow-[0_6px_10px_rgba(0,0,0,0.3)]"><AppIcon app={app} />diff --git a/frontend/slices/appshell/components/shells/android/android-parts.tsx b/frontend/slices/appshell/components/shells/android/android-parts.tsxindex 7ebef6cc..a041ba95 100644--- a/frontend/slices/appshell/components/shells/android/android-parts.tsx+++ b/frontend/slices/appshell/components/shells/android/android-parts.tsx@@ -84,9 +84,22 @@ function RecentCard({ win, app, onResume }: { win: WindowState; app?: AppDescripconst ref = useRef<HTMLDivElement>(null);const { onPointerDown, draggedRef } = useSwipeUpClose(ref, () => closeWindow(win.id));return (+ // A plain div with onClick is unreachable by keyboard. It stays a div (the+ // swipe-up-close handler needs the ref, and a <button> would swallow the+ // nested close button), so it carries the button role + a key handler by+ // hand. iOS's equivalent, WindowPreview, is a real <Surface type="button">.<divref={ref}+ role="button"+ tabIndex={0}+ aria-label={`Open ${win.title}`}onPointerDown={onPointerDown}+ onKeyDown={(e) => {+ if (e.key !== "Enter" && e.key !== " ") return;+ e.preventDefault();+ e.stopPropagation();+ onResume();+ }}onClick={(e) => {e.stopPropagation(); // a card tap resumes; only empty space → homeif (!draggedRef.current) onResume();@@ -146,7 +159,7 @@ export function AppDrawer({ apps, onLaunch, onClose }: { apps: AppDescriptor[];</Button><div className="mx-4 mt-1 flex h-11 items-center gap-3 rounded-full border border-border bg-card px-4"><Search className="size-4 text-muted-foreground" />- <input autoFocus value={q} onChange={(e) => setQ(e.target.value)} placeholder="Search apps" className="w-full bg-transparent text-sm outline-none" />+ <input autoFocus value={q} onChange={(e) => setQ(e.target.value)} aria-label="Search apps" placeholder="Search apps" className="w-full bg-transparent text-sm outline-none" /></div><divclassName="grid min-h-0 flex-1 grid-cols-4 content-start gap-x-3 gap-y-5 overflow-auto p-5"diff --git a/frontend/slices/appshell/features/notifications/components/toast-host.tsx b/frontend/slices/appshell/features/notifications/components/toast-host.tsxindex 32eff635..a5770c5c 100644--- a/frontend/slices/appshell/features/notifications/components/toast-host.tsx+++ b/frontend/slices/appshell/features/notifications/components/toast-host.tsx@@ -31,7 +31,12 @@ export function ToastHost() {<divrole="region"aria-label="Notifications"- className="pointer-events-none absolute right-3.5 top-9 z-[1000] flex flex-col items-end gap-2"+ // `top` must clear the notch: every other top-anchored overlay (dynamic+ // island, switcher, home, spotlight) offsets by --sai-top, which iOS floors+ // at 44px. This was a hardcoded 36px, so on a notched phone the stack+ // started inside the reserved band.+ style={{ top: "max(2.25rem, calc(var(--sai-top) + 0.5rem))" }}+ className="pointer-events-none absolute right-3.5 z-[1000] flex flex-col items-end gap-2">{toasts.map((t) => {const Icon = toneIcon[t.tone];@@ -66,7 +71,7 @@ export function ToastHost() {size="icon"aria-label="Dismiss"onClick={() => dismissToast(t.id)}- className="h-auto w-auto grid size-5 shrink-0 place-items-center rounded-md text-muted-foreground hover:bg-[var(--hover-strong)]"+ className="h-auto w-auto grid size-6 shrink-0 place-items-center rounded-md text-muted-foreground hover:bg-[var(--hover-strong)]"><X className="size-3.5" /></Button>diff --git a/frontend/slices/appshell/features/search/components/spotlight.tsx b/frontend/slices/appshell/features/search/components/spotlight.tsxindex 54cc408e..ba6b9ca6 100644--- a/frontend/slices/appshell/features/search/components/spotlight.tsx+++ b/frontend/slices/appshell/features/search/components/spotlight.tsx@@ -46,8 +46,9 @@ function SpotlightPanel() {// Debounced folder search under ~/projects (live) — opens Files at the hit.// Results are state, but "no query → no hits" is derived below (stale hits// stay visible during the debounce, matching the old behaviour).- const [found, setFound] = useState<{ key: string; hits: SearchHit[] } | null>(null);+ const [found, setFound] = useState<{ key: string; hits: SearchHit[]; error?: string } | null>(null);const folderHits = useMemo(() => (q.trim() ? (found?.hits ?? []) : []), [q, found]);+ const searchError = q.trim() && found?.key === q.trim() ? found.error : undefined;useEffect(() => {const query = q.trim();if (!query) return;@@ -55,7 +56,13 @@ function SpotlightPanel() {const t = setTimeout(() => {search(query).then((h) => alive && setFound({ key: query, hits: h }))- .catch(() => alive && setFound({ key: query, hits: [] }));+ // Keep the reason. Reporting a dead host API as "No matches" is a lie the+ // user cannot act on — an expired session looks exactly like an empty+ // folder. Files does this right (use-files.ts toasts the real message).+ .catch((e: unknown) => {+ const msg = e instanceof Error ? e.message : String(e);+ if (alive) setFound({ key: query, hits: [], error: msg });+ });}, 150);return () => {alive = false;@@ -186,8 +193,14 @@ function SpotlightPanel() {<ResultList id={LISTBOX_ID} results={results} selIdx={selIdx} onHover={setSel} onPick={runAt} />)}{results.length === 0 && (- <p className="border-t border-border px-5 py-4 text-sm text-muted-foreground">- No matches for “{q}”.+ <p+ role={searchError ? "alert" : undefined}+ className={cn(+ "border-t border-border px-5 py-4 text-sm",+ searchError ? "text-destructive" : "text-muted-foreground",+ )}+ >+ {searchError ? `Pencarian gagal: ${searchError}` : `No matches for “${q}”.`}</p>)}</div>diff --git a/frontend/slices/appshell/responsive/responsive-provider.test.ts b/frontend/slices/appshell/responsive/responsive-provider.test.tsnew file mode 100644index 00000000..0469c762--- /dev/null+++ b/frontend/slices/appshell/responsive/responsive-provider.test.ts@@ -0,0 +1,41 @@+import { describe, it, expect } from "vitest";+import { sameGeometry } from "./responsive-provider";+import type { Responsive } from "./use-responsive";++const base: Responsive = {+ formFactor: "desktop",+ isMobile: false,+ device: "auto",+ vw: 1280,+ vh: 800,+ pointer: "fine",+ orientation: "landscape",+ breakpoint: "lg",+ safeArea: { top: 0, right: 0, bottom: 0, left: 0 },+};++describe("sameGeometry", () => {+ it("is false against null, so the first measurement always commits", () => {+ expect(sameGeometry(null, base)).toBe(false);+ });++ it("is true for an identical viewport — this is what stops the shell re-rendering", () => {+ expect(sameGeometry(base, { ...base })).toBe(true);+ });++ it("ignores safeArea, which is derived from the fields it does compare", () => {+ expect(sameGeometry(base, { ...base, safeArea: { top: 44, right: 0, bottom: 34, left: 0 } })).toBe(true);+ });++ it.each([+ ["vw", { vw: 1281 }],+ ["vh", { vh: 799 }], // a mobile URL-bar collapse+ ["isMobile", { isMobile: true }],+ ["device", { device: "phone" as const }],+ ["pointer", { pointer: "coarse" as const }],+ ["orientation", { orientation: "portrait" as const }],+ ["breakpoint", { breakpoint: "md" as const }],+ ])("is false when %s changes", (_label, patch) => {+ expect(sameGeometry(base, { ...base, ...patch })).toBe(false);+ });+});diff --git a/frontend/slices/appshell/responsive/responsive-provider.tsx b/frontend/slices/appshell/responsive/responsive-provider.tsxindex 88e3053b..48bac8b9 100644--- a/frontend/slices/appshell/responsive/responsive-provider.tsx+++ b/frontend/slices/appshell/responsive/responsive-provider.tsx@@ -31,6 +31,24 @@ function readSafeArea(): SafeArea {};}+/** Every observable field except `safeArea`, which is a pure function of the+ * geometry compared here (device inset × orientation) — so an equal result means+ * the safe area is equal too, and we can skip reading it. Reading it is a+ * SYNCHRONOUS style recalc (getComputedStyle), and it used to run on every+ * single resize event. */+export function sameGeometry(a: Responsive | null, b: Responsive): boolean {+ return (+ a !== null &&+ a.isMobile === b.isMobile &&+ a.device === b.device &&+ a.vw === b.vw &&+ a.vh === b.vh &&+ a.pointer === b.pointer &&+ a.orientation === b.orientation &&+ a.breakpoint === b.breakpoint+ );+}+// Deterministic SSR/first-paint default: desktop, so the window manager renders// until the on-mount measurement corrects it (same no-flash behaviour the old// inline useIsMobile had — it treated "unknown" as not-mobile).@@ -64,14 +82,17 @@ export function ResponsiveProvider({const [state, setState] = useState<Responsive>(() => initial(device));useEffect(() => {- const compute = () => {+ let last: Responsive | null = null;+ let raf = 0;++ const measure = () => {const vw = window.innerWidth;const vh = window.innerHeight;const coarse = window.matchMedia?.("(pointer: coarse)").matches ?? false;const portrait = vh >= vw;const auto = vw < MOBILE_W || (coarse && portrait && vw < TABLET_W);const isMobile = device === "phone" ? true : device === "desktop" ? false : auto;- setState({+ const next: Responsive = {formFactor: isMobile ? "mobile" : "desktop",isMobile,device,@@ -80,15 +101,34 @@ export function ResponsiveProvider({pointer: coarse ? "coarse" : "fine",orientation: portrait ? "portrait" : "landscape",breakpoint: bucket(vw),- safeArea: readSafeArea(),+ safeArea: last?.safeArea ?? { top: 0, right: 0, bottom: 0, left: 0 },+ };+ if (sameGeometry(last, next)) return; // same viewport → no new object, no re-render+ next.safeArea = readSafeArea();+ last = next;+ setState(next);+ };++ // This value is consumed at the shell ROOT (Surface), so a new object here+ // re-renders the entire tree. resize fires in bursts — a mobile URL-bar+ // collapse, a soft keyboard, a desktop window drag — so coalesce to one+ // measurement per frame (which is also when layout is settled, rather than+ // mid-gesture with the layout already dirtied) and bail when nothing moved.+ const schedule = () => {+ if (raf) return;+ raf = requestAnimationFrame(() => {+ raf = 0;+ measure();});};- compute();- window.addEventListener("resize", compute);- window.addEventListener("orientationchange", compute);++ measure();+ window.addEventListener("resize", schedule);+ window.addEventListener("orientationchange", schedule);return () => {- window.removeEventListener("resize", compute);- window.removeEventListener("orientationchange", compute);+ if (raf) cancelAnimationFrame(raf);+ window.removeEventListener("resize", schedule);+ window.removeEventListener("orientationchange", schedule);};}, [device]);diff --git a/frontend/slices/auth/components/login-screen.tsx b/frontend/slices/auth/components/login-screen.tsxindex 7abc2629..029bd738 100644--- a/frontend/slices/auth/components/login-screen.tsx+++ b/frontend/slices/auth/components/login-screen.tsx@@ -93,7 +93,7 @@ export function LoginCard({ onAuthed }: { onAuthed: () => void }) {{busy && <Loader2 className="size-4 animate-spin" />}Check again</Button>- {error && <p className="text-xs text-destructive">{error}</p>}+ {error && <p role="alert" className="text-xs text-destructive">{error}</p>}</div>) : (<form onSubmit={submit} className="space-y-4">@@ -103,11 +103,20 @@ export function LoginCard({ onAuthed }: { onAuthed: () => void }) {type="password"requiredplaceholder="password"+ aria-label="Password"autoComplete="current-password"+ aria-invalid={error ? true : undefined}+ aria-describedby={error ? "login-error" : undefined}value={password}onChange={(e) => setPassword(e.target.value)}/>- {error && <p className="text-xs text-destructive">{error}</p>}+ {/* role=alert: without a live region the failure text renders silently,+ so a screen-reader user gets no signal that the password was wrong. */}+ {error && (+ <p id="login-error" role="alert" className="text-xs text-destructive">+ {error}+ </p>+ )}<Button type="submit" className="w-full [@media(pointer:coarse)]:min-h-[44px]" disabled={busy}>{busy && <Loader2 className="size-4 animate-spin" />}Unlock