Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
label switch/icon controls, restore focus indicators, and give both lightboxes real dialog semantics
[._.]/ Adam Eivyc54bce15a95c
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex efc2ad079d..5fbe1f2626 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -86,3 +86,4 @@- **[issue-2839] Extract the boot sequence from `server/index.js` into a bootstrap service** — the ~600 lines of inline startup orchestration (data migrations, collection-schema verification, AI Toolkit construction + runner registration, ~40 fire-and-forget service inits/schedulers, the ordered instance/sync/media-queue/DB chain that ends in `httpServer.listen()`, and the graceful-shutdown state machine) move to `server/services/bootstrap.js` as `bootstrapServices()` / `runBootSequence()` / `registerShutdownHandlers()`. `index.js` drops from 1259 to ~460 lines and is now HTTP/Socket.IO construction, route registration, and three calls into the bootstrap service. Boot ordering, the DB fail-fast gate, and shutdown behavior are unchanged; no new LLM calls at boot.- **Pick the sprite import source from the managed-apps list instead of typing a path** — the Sprites import panel replaced its free-text "Source root path" input with the shared `AppContextPicker`, loading `GET /api/apps` on open and filtering to non-archived apps that declare a `repoPath`; the selected app's `repoPath` becomes the importer's `sourceRoot`. Sprite pipelines always live in a repo PortOS already manages, so the typed path was a transcription hazard with no upside, and the picker sets up the eventual sync-from-app flow. `AppContextPicker` gains an `emptyRepoText` prop — its hardcoded "using default PortOS context" empty state would be wrong here, since sprite import has no PortOS fallback; the default is unchanged for existing callers.- **Fix two cross-schema breaks in the sprite detail endpoint that were hiding imported walk data** — `GET /api/sprites/:id` 500'd for every imported character because `getWalkState()`'s run-sort called `.localeCompare()` on `createdAt`, which the ElsewhereAcres source pipeline stamps as a Python epoch-seconds number rather than PortOS's own ISO string; the comparator now normalizes both shapes to milliseconds. Separately, each run's `stripPreview` field is now normalized through the existing `toRecordRelativeAssetPath()` helper (`server/services/sprites/paths.js`, mirroring the same rebase-on-read convention `reference.js` already uses for anchor paths): the source pipeline names the field `stripPreview.path` and anchors it at its own repo root, so PortOS's `stripPreview.stripPath`-reading client 404'd on every animated walk-loop thumbnail even once the 500 was fixed. Neither fix rewrites the imported files on disk — normalization happens in memory at read time, so the importer's hash-verified provenance is untouched. New regression coverage in `walk.test.js`. Filed #2924 to cover the one remaining gap: `pioneer`'s `east` direction was approved from an imagegen-redraw pipeline the grok-video-only walk viewer doesn't model, so it shows "approved" but no animated thumbnail.+- **Accessibility audit pass: switches, icon-only buttons, focus rings, and the media lightbox** — four hand-rolled toggle switches (CoS Dynamic Avatar, Digital Twin ingestion, scheduled backups, Sharing import mode) were announced as plain unlabeled buttons with no on/off state; they now carry `role="switch"` + `aria-checked` + a name. A dozen icon-only buttons gained accessible names (cron cancel, folder "go up", rapid-reader chunk size, JIRA project clear, writing-sample remove, memory-practice mark correct/incorrect, calendar icon picker) and the process/agent expand carets gained `aria-expanded`. Six inputs that set `focus:outline-none` inside an unstyled wrapper were invisible when focused — their containers now carry `focus-within:border-port-accent`, and four standalone selects/buttons gained a `focus-visible` ring. The Sprites asset preview moved from a click-to-dismiss overlay to the shared `<Modal>` (Esc, focus trap, focus restore), and `MediaLightbox` — which deliberately opts out of `<Modal>` — now supplies its own `role="dialog"`/`aria-modal` and focus trap instead of letting Tab walk out into the page behind it. ~20 unlabeled toolbar controls on the highest-traffic pages (Runner, Review, Wiki, Tribe, Loras, Media History, Media Collections, Prompt Manager) gained labels. A new `client/src/a11yConventions.test.js` guard fails the suite if a new hand-rolled full-screen backdrop or an unlabeled toggle-switch button is introduced; the remaining unlabeled-control backlog is tracked in `PLAN.md`.diff --git a/PLAN.md b/PLAN.mdindex 386442ab1f..9a1edd123e 100644--- a/PLAN.md+++ b/PLAN.md@@ -276,3 +276,36 @@ Deferred from the fix that makes `server/services/localLlm.js#installModel`/`del- [ ] **Dedup the refresh fan-out by daemon base URL instead of by provider.** When N providers (the built-in `ollama` provider plus one or more Claude/Codex/Gemini-over-Ollama CLI/TUI providers) all resolve to the same Ollama daemon (commonly the shared `http://localhost:11434` default — see `ollamaBaseFromProvider` in `server/lib/aiToolkit/providers.js` ~line 124), `refreshOllamaBackedProviders`'s `Promise.all` currently calls `refreshProviderModels(p.id)` once per provider, each independently re-fetching `/api/tags` and re-running the full per-model `/api/show` tool-capability probe against the identical daemon/model set. Fix by grouping providers by normalized base URL, computing the tool-capable model list once per unique base, and applying it to every provider sharing that base. Flagged by the `/simplify` efficiency review — deferred because it needs a "compute without persisting" variant exposed from `server/lib/aiToolkit/providers.js` (see next item), which is a larger surface change than a `localLlm.js`-only fix.- [ ] **`refreshProviderModels` does one full `providers.json` write per call — batch writes when refreshing multiple providers.** `server/lib/aiToolkit/providers.js#refreshProviderModels` (~line 646) does `loadProviders()` → mutate → `saveProviders(data)` per call, and `saveProviders` invalidates the provider cache and `atomicWrite`s the entire file. `refreshOllamaBackedProviders`'s concurrent fan-out means N Ollama-backed providers produce N full-file writes landing in quick succession (each superseded by the next) and N cache invalidate/repopulate cycles for any concurrent `getAllProviders()`/`getProviderById()` reader. Fix by adding a batch-refresh entry point to the toolkit's provider service that computes all the new model lists first, then applies + persists once. Flagged by the `/simplify` efficiency review — deferred as an `aiToolkit/providers.js` API change, out of scope for the triggering bug fix.++### Accessibility: unlabeled form controls outside `FormField` (audit pass 4 backlog)++The 2026-07-23 audit pass fixed the toggle-switch, icon-button, focus-indicator, and+lightbox-dialog gaps, plus ~20 unlabeled controls on the highest-traffic pages+(RunnerPage, Review, Wiki, Tribe, Loras, MediaHistory, MediaCollections,+PromptManager). What remains is the long tail of standalone `<select>`/`<input>`/+`<textarea>` that sit in toolbars and inline rows rather than inside a labeling+wrapper (`client/src/components/ui/FormField.jsx`, or a local `Field` that wraps+children in a `<label>`). A placeholder is not a label — it disappears on input and+is not reliably announced.++- [ ] **Sweep the remaining unlabeled controls.** The scan that produced this list+ is: for every git-tracked `client/src/**/*.jsx`, parse each `<input|select|textarea>`+ opening tag (brace-aware, so `className={`…`}` containing `>` doesn't truncate it);+ skip tags carrying `aria-label`/`aria-labelledby`/`type="hidden"`, tags whose `id`+ is targeted by an `htmlFor` in the same file, and tags whose preceding ~14 lines+ contain `<FormField`/`<label`/`<Field`/`label=`/`sr-only`. That yields ~400 hits,+ but the true-positive rate is roughly half — the rest are `<img>`/`<select>`+ mentions inside comments and wrappers the lookback window missed. **Verify each+ candidate by reading its context before labeling it**; do not mass-apply. Highest+ value first: `Instances.jsx` (~10), `PipelineSeries.jsx`, `VideoTimelineEditor.jsx`,+ `CatalogIngredient.jsx`, `CharacterSheet.jsx`, `GitHub.jsx`, `Sharing.jsx`,+ `MoodBoardDetail.jsx`, `OpenClaw.jsx`, `LoraDatasetDetail.jsx`, `Browser.jsx`.+ Prefer wrapping in `FormField` (visible label + `htmlFor`/`id` pairing) over an+ `aria-label` when the surface has room for a visible label.+- [ ] **Consider `eslint-plugin-jsx-a11y` in `client/eslint.config.js`.** It would+ enforce this class automatically instead of relying on periodic audits. Skipped in+ this pass because enabling it surfaces hundreds of findings at once and would fail+ CI until the backlog above is drained — sequence it after the sweep, and start with+ only the rules the repo already honors (`jsx-a11y/alt-text`,+ `jsx-a11y/aria-props`, `jsx-a11y/role-has-required-aria-props`,+ `jsx-a11y/label-has-associated-control`) rather than the full `recommended` set.diff --git a/client/src/a11yConventions.test.js b/client/src/a11yConventions.test.jsnew file mode 100644index 0000000000..1e60ce6d1c--- /dev/null+++ b/client/src/a11yConventions.test.js@@ -0,0 +1,120 @@+/**+ * Repo-wide accessibility conventions.+ *+ * These encode the two regressions that keep reappearing across a11y audit+ * passes, so a new component fails the suite instead of shipping the gap:+ *+ * 1. A hand-rolled `fixed inset-0 … bg-black/N` overlay instead of the shared+ * `ui/Modal`, which owns the focus trap, the Esc stack, `role="dialog"`,+ * and focus restore. A hand-rolled backdrop is click-to-dismiss only — a+ * keyboard user has no way out and tabs straight through to the page+ * behind it.+ * 2. A toggle-switch-shaped `<button>` (a pill track with a sliding knob)+ * that never says it is a switch, so assistive tech announces "button"+ * with no on/off state. `components/ToggleSwitch.jsx` is the shared+ * widget; hand-rolled tracks must at least carry `role="switch"` ++ * `aria-checked`.+ *+ * Scoped to git-tracked `.jsx` under `client/src` so an untracked scratch file+ * can't fail the suite.+ */++import { describe, it, expect } from 'vitest';+import { execSync } from 'child_process';+import { readFileSync } from 'fs';+import { join, dirname } from 'path';+import { fileURLToPath } from 'url';++const CLIENT_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..');++function trackedJsxFiles() {+ const out = execSync('git ls-files src', { cwd: CLIENT_ROOT, encoding: 'utf8' });+ return out.trim().split('\n').filter(f => f.endsWith('.jsx') && !f.includes('.test.'));+}++/**+ * Slice out the full opening tag starting at `index`, tolerating `>` inside+ * JSX expression containers (`className={`a > b`}`) by tracking brace depth.+ */+function openingTagAt(src, index, nameLength) {+ let depth = 0;+ for (let i = index + nameLength; i < src.length; i++) {+ const c = src[i];+ if (c === '{') depth++;+ else if (c === '}') depth--;+ else if (c === '>' && depth === 0) return src.slice(index, i + 1);+ }+ return null;+}++const lineOf = (src, index) => src.slice(0, index).split('\n').length;++describe('a11y conventions', () => {+ // Modal.jsx IS the shared implementation; Drawer and Layout use the same+ // backdrop treatment for a slide-in panel / mobile nav scrim, both of which+ // already own Esc + focus handling of their own.+ // MediaLightbox documents its opt-out at the top of the file (viewport-edge+ // chevrons + a layered Esc cascade Modal's stack would swallow) and supplies+ // the dialog semantics itself: role="dialog"/aria-modal, useFocusTrap, and a+ // window-level Esc handler.+ const MODAL_BACKDROP_ALLOWLIST = new Set([+ 'src/components/ui/Modal.jsx',+ 'src/components/Drawer.jsx',+ 'src/components/Layout.jsx',+ 'src/components/media/MediaLightbox.jsx',+ ]);++ it('routes full-screen dark overlays through the shared <Modal>', () => {+ const offenders = [];+ for (const file of trackedJsxFiles()) {+ if (MODAL_BACKDROP_ALLOWLIST.has(file)) continue;+ const src = readFileSync(join(CLIENT_ROOT, file), 'utf8');+ // Only a dimming backdrop counts — `fixed inset-0` alone is also used for+ // non-modal chrome (HUD panels, drag overlays, canvas layers).+ const re = /fixed inset-0[^"'`]*bg-black\//g;+ let m;+ while ((m = re.exec(src))) {+ offenders.push(`${file}:${lineOf(src, m.index)}`);+ }+ }+ expect(offenders, `Hand-rolled modal backdrop — use components/ui/Modal.jsx (focus trap + Esc stack + role=dialog):\n${offenders.join('\n')}`).toEqual([]);+ });++ it('marks toggle-switch buttons with role="switch"', () => {+ // Pill-track dimensions used by the hand-rolled toggles in this codebase.+ // A switch is always a fixed-size rounded-full track roughly twice as wide+ // as it is tall; ordinary rounded-full buttons (icon buttons, chips) don't+ // pin both dimensions like this.+ const TRACK_SIZES = /\b(h-6 w-11|w-11 h-6|w-10 h-5|h-5 w-10|h-5 w-9|w-9 h-5|h-8 w-14|w-14 h-8|h-7 w-12|w-12 h-7)\b/;+ const offenders = [];+ for (const file of trackedJsxFiles()) {+ const src = readFileSync(join(CLIENT_ROOT, file), 'utf8');+ const re = /<button\b/g;+ let m;+ while ((m = re.exec(src))) {+ const tag = openingTagAt(src, m.index, '<button'.length);+ if (!tag) continue;+ if (!/rounded-full/.test(tag) || !TRACK_SIZES.test(tag)) continue;+ if (/role="switch"/.test(tag)) continue;+ offenders.push(`${file}:${lineOf(src, m.index)}`);+ }+ }+ expect(offenders, `Toggle-switch button without role="switch" + aria-checked — prefer components/ToggleSwitch.jsx:\n${offenders.join('\n')}`).toEqual([]);+ });++ it('gives every role="switch" an aria-checked state', () => {+ const offenders = [];+ for (const file of trackedJsxFiles()) {+ const src = readFileSync(join(CLIENT_ROOT, file), 'utf8');+ const re = /<button\b/g;+ let m;+ while ((m = re.exec(src))) {+ const tag = openingTagAt(src, m.index, '<button'.length);+ if (!tag || !/role="switch"/.test(tag)) continue;+ if (/aria-checked/.test(tag)) continue;+ offenders.push(`${file}:${lineOf(src, m.index)}`);+ }+ }+ expect(offenders, `role="switch" without aria-checked:\n${offenders.join('\n')}`).toEqual([]);+ });+});diff --git a/client/src/components/CronInput.jsx b/client/src/components/CronInput.jsxindex fdff3c3ca8..b01410d8ad 100644--- a/client/src/components/CronInput.jsx+++ b/client/src/components/CronInput.jsx@@ -39,6 +39,7 @@ export default function CronInput({ value, onSave, onCancel, className = '' }) {<buttontype="button"onClick={onCancel}+ aria-label="Cancel custom cron expression"className="px-1.5 py-1 text-gray-500 hover:text-gray-300 rounded text-xs">Xdiff --git a/client/src/components/FolderPicker.jsx b/client/src/components/FolderPicker.jsxindex 51149b9310..41f131423d 100644--- a/client/src/components/FolderPicker.jsx+++ b/client/src/components/FolderPicker.jsx@@ -186,6 +186,7 @@ export default function FolderPicker({ value, onChange, defaultPath }) {<buttontype="button"onClick={() => handleNavigate(parentPath)}+ aria-label="Go to parent folder"className="w-full flex items-center gap-3 px-3 py-2 text-left rounded-lg hover:bg-port-border/50 text-gray-400 hover:text-white transition-colors"><ChevronUp size={18} />diff --git a/client/src/components/RapidReader.jsx b/client/src/components/RapidReader.jsxindex 291a955586..83e73645f4 100644--- a/client/src/components/RapidReader.jsx+++ b/client/src/components/RapidReader.jsx@@ -240,6 +240,7 @@ export default function RapidReader({onClick={() => setChunkSize(1)}className={`px-2 py-1 text-xs ${chunkSize === 1 ? 'bg-port-accent/20 text-port-accent' : 'text-gray-400 hover:text-white'}`}aria-pressed={chunkSize === 1}+ aria-label="Show one word at a time">1w</button>@@ -248,6 +249,7 @@ export default function RapidReader({onClick={() => setChunkSize(2)}className={`px-2 py-1 text-xs ${chunkSize === 2 ? 'bg-port-accent/20 text-port-accent' : 'text-gray-400 hover:text-white'}`}aria-pressed={chunkSize === 2}+ aria-label="Show two words at a time">2w</button>diff --git a/client/src/components/apps/EditAppDrawer.jsx b/client/src/components/apps/EditAppDrawer.jsxindex 7f6d28d0ea..7574597032 100644--- a/client/src/components/apps/EditAppDrawer.jsx+++ b/client/src/components/apps/EditAppDrawer.jsx@@ -767,6 +767,7 @@ export default function EditAppDrawer({ app, onClose, onSave }) {<buttontype="button"onClick={() => selectProject('')}+ aria-label="Clear JIRA project"className="absolute right-2 top-8 text-gray-500 hover:text-white text-sm">xdiff --git a/client/src/components/apps/tabs/ProcessesTab.jsx b/client/src/components/apps/tabs/ProcessesTab.jsxindex 2a0c73251d..9dd55da799 100644--- a/client/src/components/apps/tabs/ProcessesTab.jsx+++ b/client/src/components/apps/tabs/ProcessesTab.jsx@@ -146,6 +146,8 @@ export default function ProcessesTab({ pm2ProcessNames, filterFn }) {<td className="px-4 py-3"><buttononClick={() => toggleExpand(proc.name)}+ aria-expanded={expandedProcess === proc.name}+ aria-label={`${expandedProcess === proc.name ? 'Collapse' : 'Expand'} details for ${proc.name}`}className="text-gray-400 hover:text-white transition-transform"><span className={`inline-block transition-transform ${expandedProcess === proc.name ? 'rotate-90' : ''}`}>▶</span>diff --git a/client/src/components/brain/tabs/NotesTab.jsx b/client/src/components/brain/tabs/NotesTab.jsxindex db98250d63..1371fe90f9 100644--- a/client/src/components/brain/tabs/NotesTab.jsx+++ b/client/src/components/brain/tabs/NotesTab.jsx@@ -657,19 +657,14 @@ function VaultSetup({ detectedVaults, vaults, customPath, setCustomPath, adding,{vaults.length > 0 && (<div><h3 className="text-sm font-medium text-gray-400 mb-2">Connected Vaults</h3>+ {/* No remove affordance on these rows: VaultSetup is never handed a+ delete handler, and an inert trash button is worse than none — it+ is focusable, unlabeled, and implies an action that never runs. */}<div className="space-y-2">{vaults.map(v => (- <div key={v.id} className="flex items-center justify-between p-3 rounded-lg bg-port-card border border-port-border">- <div>- <span className="text-white font-medium">{v.name}</span>- <span className="text-xs text-gray-500 block truncate">{v.path}</span>- </div>- <button- onClick={() => onAdd === null ? null : null} // placeholder, actual delete handled separately- className="text-gray-500 hover:text-port-error p-1"- >- <Trash2 size={14} />- </button>+ <div key={v.id} className="p-3 rounded-lg bg-port-card border border-port-border">+ <span className="text-white font-medium">{v.name}</span>+ <span className="text-xs text-gray-500 block truncate">{v.path}</span></div>))}</div>diff --git a/client/src/components/cos/tabs/ConfigTab.jsx b/client/src/components/cos/tabs/ConfigTab.jsxindex 6d6a745cb0..7ac4c469c6 100644--- a/client/src/components/cos/tabs/ConfigTab.jsx+++ b/client/src/components/cos/tabs/ConfigTab.jsx@@ -511,6 +511,10 @@ export default function ConfigTab({ config, onUpdate, onEvaluate, avatarStyle, s<p className="text-xs text-gray-600 mt-0.5">Auto-switch style based on task type, provider, or priority</p></div><button+ type="button"+ role="switch"+ aria-checked={!!config?.dynamicAvatar}+ aria-label="Dynamic Avatar"onClick={async () => {const newVal = !config?.dynamicAvatar;await api.updateCosConfig({ dynamicAvatar: newVal });diff --git a/client/src/components/digital-twin/tabs/AccountsTab.jsx b/client/src/components/digital-twin/tabs/AccountsTab.jsxindex af966f30a0..83cc547b3d 100644--- a/client/src/components/digital-twin/tabs/AccountsTab.jsx+++ b/client/src/components/digital-twin/tabs/AccountsTab.jsx@@ -389,6 +389,10 @@ export default function AccountsTab() {{/* Ingestion toggle */}<div className="flex items-center gap-3"><button+ type="button"+ role="switch"+ aria-checked={!!form.ingestionEnabled}+ aria-label="Enable content ingestion"onClick={() => setForm(prev => ({ ...prev, ingestionEnabled: !prev.ingestionEnabled }))}className={`relative w-10 h-5 rounded-full transition-colors ${form.ingestionEnabled ? 'bg-port-accent' : 'bg-gray-600'diff --git a/client/src/components/digital-twin/tabs/EnrichTab.jsx b/client/src/components/digital-twin/tabs/EnrichTab.jsxindex 05c4135b13..49dd2dad04 100644--- a/client/src/components/digital-twin/tabs/EnrichTab.jsx+++ b/client/src/components/digital-twin/tabs/EnrichTab.jsx@@ -578,6 +578,7 @@ export default function EnrichTab({ onRefresh }) {<buttontype="button"onClick={() => removeWritingSample(index)}+ aria-label={`Remove writing sample ${index + 1}`}className="absolute top-2 right-2 text-gray-500 hover:text-red-400">×diff --git a/client/src/components/imageGen/HfTokenBanner.jsx b/client/src/components/imageGen/HfTokenBanner.jsxindex 007dafcf05..19e36b2fcf 100644--- a/client/src/components/imageGen/HfTokenBanner.jsx+++ b/client/src/components/imageGen/HfTokenBanner.jsx@@ -49,7 +49,7 @@ export default function HfTokenBanner({ modelLabel, licenseUrl, onSaved }) {and paste it below.</div><div className="flex flex-col sm:flex-row gap-2 items-stretch sm:items-center">- <div className="flex items-center gap-1.5 flex-1 bg-port-bg border border-port-border rounded-lg px-2 py-1.5">+ <div className="flex items-center gap-1.5 flex-1 bg-port-bg border border-port-border rounded-lg px-2 py-1.5 focus-within:border-port-accent"><Key size={14} className="text-gray-400 flex-shrink-0" /><inputtype="password"diff --git a/client/src/components/meatspace/post/MemoryPractice.jsx b/client/src/components/meatspace/post/MemoryPractice.jsxindex 7ae4819c07..1fed4df6a1 100644--- a/client/src/components/meatspace/post/MemoryPractice.jsx+++ b/client/src/components/meatspace/post/MemoryPractice.jsx@@ -774,8 +774,8 @@ function SpeedRunLine({ line, index, onResult }) {</span>{marked === null && (<div className="flex gap-1 shrink-0">- <button onClick={() => mark(true)} className="p-1 text-port-success hover:bg-port-success/10 rounded"><Check size={14} /></button>- <button onClick={() => mark(false)} className="p-1 text-port-error hover:bg-port-error/10 rounded"><X size={14} /></button>+ <button onClick={() => mark(true)} aria-label={`Mark line ${index + 1} correct`} className="p-1 text-port-success hover:bg-port-success/10 rounded"><Check size={14} /></button>+ <button onClick={() => mark(false)} aria-label={`Mark line ${index + 1} incorrect`} className="p-1 text-port-error hover:bg-port-error/10 rounded"><X size={14} /></button></div>)}</div>diff --git a/client/src/components/meatspace/tabs/calendar/AddActivityForm.jsx b/client/src/components/meatspace/tabs/calendar/AddActivityForm.jsxindex 7cabd0248e..899a3bcc46 100644--- a/client/src/components/meatspace/tabs/calendar/AddActivityForm.jsx+++ b/client/src/components/meatspace/tabs/calendar/AddActivityForm.jsx@@ -1,4 +1,4 @@-import { useState } from 'react';+import { useId, useState } from 'react';import { Plus } from 'lucide-react';import { ICON_MAP, IconForName } from './icons';import { FormField } from '../../../ui/FormField';@@ -9,6 +9,7 @@ export default function AddActivityForm({ onAdd }) {const [cadence, setCadence] = useState('day');const [frequency, setFrequency] = useState('1');const [icon, setIcon] = useState('circle');+ const iconLabelId = useId();const handleSubmit = (e) => {e.preventDefault();@@ -48,13 +49,17 @@ export default function AddActivityForm({ onAdd }) {/></FormField><div>- <label className="text-xs text-gray-400 mb-1 block">Icon</label>- <div className="flex gap-1 flex-wrap">+ {/* A bare <label> with no control is inert for assistive tech — this+ names the button group instead. */}+ <span id={iconLabelId} className="text-xs text-gray-400 mb-1 block">Icon</span>+ <div className="flex gap-1 flex-wrap" role="group" aria-labelledby={iconLabelId}>{iconOptions.map(ic => (<buttonkey={ic}type="button"onClick={() => setIcon(ic)}+ aria-label={`Icon: ${ic}`}+ aria-pressed={icon === ic}className={`p-1.5 rounded ${icon === ic ? 'bg-port-accent/20 text-port-accent' : 'text-gray-500 hover:text-white'}`}><IconForName name={ic} size={14} />diff --git a/client/src/components/media/MediaLightbox.jsx b/client/src/components/media/MediaLightbox.jsxindex 5d1990e8de..b12bc0f721 100644--- a/client/src/components/media/MediaLightbox.jsx+++ b/client/src/components/media/MediaLightbox.jsx@@ -10,6 +10,7 @@ import MediaImage from '../MediaImage';import { useScrollLock } from '../../hooks/useScrollLock';import { useSwipeNav } from '../../hooks/useSwipeNav';import { isEditableTarget } from '../../hooks/useKeyboardShortcuts';+import useFocusTrap from '../../hooks/useFocusTrap.js';import { copyToClipboard } from '../../lib/clipboard';import { IMAGE_GEN_MODE } from '../../lib/imageGenBackends';import { formatDateTime } from '../../utils/formatters';@@ -30,6 +31,9 @@ import { formatDateTime } from '../../utils/formatters';// keydown listener.// (A mobile tap-to-open bottom-sheet drawer existed pre-ed0e4859 and was// removed because it covered the image area in fullscreen.)+// Opting out means owning the dialog semantics Modal would have supplied:+// the overlay carries role="dialog"/aria-modal and runs useFocusTrap itself,+// and `a11yConventions.test.js` allowlists it on that basis.const NOTE_MAX = 2000;const NOTE_DEBOUNCE_MS = 500;@@ -112,6 +116,13 @@ export default function MediaLightbox({const refs = useRef({ onClose, onPrevious, onNext, onAnnotationChange, starred });useEffect(() => { refs.current = { onClose, onPrevious, onNext, onAnnotationChange, starred }; });const videoRef = useRef(null);+ // The overlay opts out of <ui/Modal> (see the note at the top of the file),+ // so it has to bring its own dialog semantics: without the trap, Tab walks+ // straight out of the lightbox into the page underneath it, and focus never+ // returns to the thumbnail that opened it (WCAG 2.4.3 / 2.1.2). Esc is+ // already handled by the window-level cascade below.+ const overlayRef = useRef(null);+ useFocusTrap(!!item, overlayRef);// Play videos with SOUND on open. The declarative `muted autoPlay` baseline// (on the <video> below) is what lets the clip start at all on mobile —// iOS/Android block *unmuted* autoplay that isn't tied to a user gesture. But@@ -225,7 +236,10 @@ export default function MediaLightbox({return (<div- role="presentation"+ ref={overlayRef}+ role="dialog"+ aria-modal="true"+ aria-label={`Media viewer — ${item.filename || item.key || 'item'}`}className={`fixed inset-0 z-50 bg-black/90 flex items-center justify-center ${overlayPad}`}onClick={onClose}onKeyDown={(e) => e.key === 'Escape' && onClose()}diff --git a/client/src/components/settings/BackupTab.jsx b/client/src/components/settings/BackupTab.jsxindex 6457060504..0a1ce929fa 100644--- a/client/src/components/settings/BackupTab.jsx+++ b/client/src/components/settings/BackupTab.jsx@@ -251,9 +251,11 @@ export function BackupTab() {<div className="flex items-center gap-3"><span className="text-sm text-gray-400">Enabled</span><button+ type="button"+ role="switch"onClick={() => setEnabled(!enabled)}- aria-label={enabled ? 'Disable scheduled backups' : 'Enable scheduled backups'}- aria-pressed={enabled}+ aria-label="Scheduled backups"+ aria-checked={enabled}className={`relative w-10 h-5 rounded-full transition-colors ${enabled ? 'bg-port-accent' : 'bg-port-border'}`}><span className={`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform ${enabled ? 'translate-x-5' : ''}`} />diff --git a/client/src/components/settings/LocalLlmTab.jsx b/client/src/components/settings/LocalLlmTab.jsxindex 103c8eb76e..05853b999c 100644--- a/client/src/components/settings/LocalLlmTab.jsx+++ b/client/src/components/settings/LocalLlmTab.jsx@@ -734,7 +734,7 @@ export function LocalLlmTab() {{/* Free-text install + search */}<div className="flex flex-col sm:flex-row gap-2">- <div className="flex-1 flex items-center gap-2 bg-port-bg border border-port-border rounded-lg px-3">+ <div className="flex-1 flex items-center gap-2 bg-port-bg border border-port-border rounded-lg px-3 focus-within:border-port-accent"><Search size={14} className="text-gray-500" /><label htmlFor="llm-catalog-search" className="sr-only">{`Search the ${labelFor(selected)} model catalog`}</label><inputdiff --git a/client/src/components/universe/UniverseCanonSection.jsx b/client/src/components/universe/UniverseCanonSection.jsxindex ff7115d917..d813413da5 100644--- a/client/src/components/universe/UniverseCanonSection.jsx+++ b/client/src/components/universe/UniverseCanonSection.jsx@@ -666,7 +666,7 @@ export default function UniverseCanonSection({</div><div className="flex items-center gap-2 flex-wrap">{seriesOptions.length > 1 ? (- <label className="inline-flex items-center gap-1.5 px-2 py-1.5 rounded bg-port-bg border border-port-border text-gray-300 text-xs">+ <label className="inline-flex items-center gap-1.5 px-2 py-1.5 rounded bg-port-bg border border-port-border text-gray-300 text-xs focus-within:border-port-accent"><Filter size={12} className="text-gray-500" /><span className="sr-only">Filter by series</span><selectdiff --git a/client/src/components/universeBuilder/InfluenceChipsInput.jsx b/client/src/components/universeBuilder/InfluenceChipsInput.jsxindex fd3162b904..2434423c4b 100644--- a/client/src/components/universeBuilder/InfluenceChipsInput.jsx+++ b/client/src/components/universeBuilder/InfluenceChipsInput.jsx@@ -94,7 +94,9 @@ export default function InfluenceChipsInput({onChange(arrayMove(safe, oldIdx, newIdx));};- const containerCls = `flex flex-wrap items-center gap-1.5 p-2 bg-port-bg border border-port-border rounded ${readOnly ? 'opacity-70' : ''}`;+ // focus-within carries the focus indicator for the borderless inner input,+ // which sets `focus:outline-none` to blend into the chip row.+ const containerCls = `flex flex-wrap items-center gap-1.5 p-2 bg-port-bg border border-port-border rounded focus-within:border-port-accent ${readOnly ? 'opacity-70' : ''}`;// Read-only path: no DnD wrapper, no input, no remove buttons — just chips.if (readOnly) {@@ -177,7 +179,7 @@ function SortableChip({ token, toneClass, onRemove }) {type="button"{...attributes}{...listeners}- className="cursor-grab active:cursor-grabbing text-current/60 hover:text-current focus:outline-none"+ className="cursor-grab active:cursor-grabbing text-current/60 hover:text-current focus:outline-none focus-visible:ring-1 focus-visible:ring-port-accent rounded"aria-label={`Drag ${token} to reorder`}title="Drag to reorder">diff --git a/client/src/components/voice/VoiceWidget.jsx b/client/src/components/voice/VoiceWidget.jsxindex 7b2430d248..5e7e97e72b 100644--- a/client/src/components/voice/VoiceWidget.jsx+++ b/client/src/components/voice/VoiceWidget.jsx@@ -744,7 +744,7 @@ export default function VoiceWidget() {)}<formonSubmit={(e) => { e.preventDefault(); handleSend(); }}- className={`flex items-center gap-1 bg-port-card/95 backdrop-blur border rounded-full pl-4 pr-1 py-1 w-full ${fabSurface}`}+ className={`flex items-center gap-1 bg-port-card/95 backdrop-blur border rounded-full pl-4 pr-1 py-1 w-full focus-within:border-port-accent ${fabSurface}`}><inputtype="text"diff --git a/client/src/pages/AgentsPage.jsx b/client/src/pages/AgentsPage.jsxindex fb0c15db28..9e9b1c9bd1 100644--- a/client/src/pages/AgentsPage.jsx+++ b/client/src/pages/AgentsPage.jsx@@ -189,6 +189,8 @@ export function AgentsPage() {<td className="px-4 py-4"><buttononClick={() => toggleExpand(agent.pid)}+ aria-expanded={expandedPid === agent.pid}+ aria-label={`${expandedPid === agent.pid ? 'Collapse' : 'Expand'} details for agent ${agent.pid}`}className="text-gray-400 hover:text-white transition-transform"><span className={`inline-block transition-transform ${expandedPid === agent.pid ? 'rotate-90' : ''}`}>▶</span>diff --git a/client/src/pages/Loras.jsx b/client/src/pages/Loras.jsxindex 575946ca92..da1250e684 100644--- a/client/src/pages/Loras.jsx+++ b/client/src/pages/Loras.jsx@@ -268,6 +268,7 @@ export default function Loras() {type="text"value={installUrl}onChange={(e) => setInstallUrl(e.target.value)}+ aria-label="Civitai model URL"placeholder="https://civitai.com/models/2600698/realstagram"className="flex-1 bg-port-bg border border-port-border rounded px-3 py-2 text-sm text-gray-200 placeholder:text-gray-600"disabled={installing}@@ -301,6 +302,7 @@ export default function Loras() {type="text"value={hfUrl}onChange={(e) => setHfUrl(e.target.value)}+ aria-label="HuggingFace video LoRA URL"placeholder="https://huggingface.co/fal/ltx2.3-audio-reactive-lora"className="flex-1 bg-port-bg border border-port-border rounded px-3 py-2 text-sm text-gray-200 placeholder:text-gray-600"disabled={hfInstalling}diff --git a/client/src/pages/MediaCollections.jsx b/client/src/pages/MediaCollections.jsxindex b435377e6d..3badd46dba 100644--- a/client/src/pages/MediaCollections.jsx+++ b/client/src/pages/MediaCollections.jsx@@ -127,6 +127,7 @@ export default function MediaCollections() {value={name}onChange={(e) => setName(e.target.value)}maxLength={80}+ aria-label="New collection name"placeholder="New collection name"className="flex-1 bg-port-card border border-port-border rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-port-accent"/>diff --git a/client/src/pages/MediaHistory.jsx b/client/src/pages/MediaHistory.jsxindex 93cfd85ffc..f10d4fab4e 100644--- a/client/src/pages/MediaHistory.jsx+++ b/client/src/pages/MediaHistory.jsx@@ -165,6 +165,7 @@ export default function MediaHistory() {type="text"value={query}onChange={(e) => setQuery(e.target.value)}+ aria-label="Search media history"placeholder="Search prompt, model, character, place…"className="w-full pl-7 pr-7 py-1 bg-port-bg border border-port-border rounded text-xs text-white placeholder-gray-500 focus:outline-none focus:border-port-accent"/>diff --git a/client/src/pages/PromptManager.jsx b/client/src/pages/PromptManager.jsxindex 055d59c1a5..ab3bbced04 100644--- a/client/src/pages/PromptManager.jsx+++ b/client/src/pages/PromptManager.jsx@@ -457,6 +457,7 @@ export default function PromptManager() {</div>{!stageConfig.provider ? (<select+ aria-label="Model tier"value={stageConfig.model || 'default'}onChange={(e) => setStageConfig({ ...stageConfig, model: e.target.value })}className="w-full px-3 py-2 bg-port-bg border border-port-border rounded-lg text-white focus:border-port-accent focus:outline-hidden"@@ -827,6 +828,7 @@ export default function PromptManager() {</div>{!newStageForm.provider ? (<select+ aria-label="Model tier"value={newStageForm.model}onChange={(e) => setNewStageForm({ ...newStageForm, model: e.target.value })}className="w-full px-3 py-2 bg-port-bg border border-port-border rounded-lg text-white focus:border-port-accent focus:outline-hidden"diff --git a/client/src/pages/Review.jsx b/client/src/pages/Review.jsxindex cf4fbf6e78..c6aa315b5e 100644--- a/client/src/pages/Review.jsx+++ b/client/src/pages/Review.jsx@@ -296,6 +296,7 @@ export default function Review() {</h2><div className="flex items-center gap-2 flex-wrap"><select+ aria-label="Filter review items by status"value={filter}onChange={(e) => setFilter(e.target.value)}className="bg-port-card border border-port-border rounded-lg px-3 py-2 text-sm text-gray-300"@@ -380,6 +381,7 @@ export default function Review() {type="text"value={newTodo}onChange={(e) => setNewTodo(e.target.value)}+ aria-label="Quick add todo"placeholder="Quick add todo..."className="flex-1 bg-port-card border border-port-border rounded-lg px-3 py-2 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-port-accent"/>@@ -639,7 +641,7 @@ function QueueRow({ item, onDrill, onDismiss, onResolve, onPromoteAsk, resolvingonPromoteAsk(item, 'goal', goalId);e.target.value = '';}}- className="px-2 py-1 rounded-md text-xs font-medium text-port-accent bg-port-accent/10 hover:bg-port-accent/20 border border-port-accent/30 transition-colors disabled:opacity-40 disabled:cursor-not-allowed focus:outline-none"+ className="px-2 py-1 rounded-md text-xs font-medium text-port-accent bg-port-accent/10 hover:bg-port-accent/20 border border-port-accent/30 transition-colors disabled:opacity-40 disabled:cursor-not-allowed focus:outline-none focus-visible:ring-2 focus-visible:ring-port-accent"title="Promote the latest answer into a goal's progress"><option value="">→ Goal…</option>@@ -711,12 +713,14 @@ function ReviewItem({ item, config, isEditing, onComplete, onDismiss, onDelete,type="text"value={editTitle}onChange={(e) => setEditTitle(e.target.value)}+ aria-label="Title"className="w-full bg-port-bg border border-port-border rounded px-2 py-1 text-sm text-white focus:outline-none focus:border-port-accent"autoFocus/><textareavalue={editDescription}onChange={(e) => setEditDescription(e.target.value)}+ aria-label="Description"placeholder="Description (optional)"rows={2}className="w-full bg-port-bg border border-port-border rounded px-2 py-1 text-sm text-gray-300 focus:outline-none focus:border-port-accent resize-none"diff --git a/client/src/pages/RunnerPage.jsx b/client/src/pages/RunnerPage.jsxindex b8e52f9a4a..a03ea6cdd1 100644--- a/client/src/pages/RunnerPage.jsx+++ b/client/src/pages/RunnerPage.jsx@@ -336,6 +336,7 @@ ${prompt.trim()}`;<div className="flex flex-wrap gap-3">{/* Workspace */}<select+ aria-label="Workspace"value={selectedAppId}onChange={(e) => setSelectedAppId(e.target.value)}className="px-3 py-2 bg-port-bg border border-port-border rounded-lg text-white text-sm"@@ -349,6 +350,7 @@ ${prompt.trim()}`;<>{/* Provider */}<select+ aria-label="AI provider"value={selectedProvider}onChange={(e) => {setSelectedProvider(e.target.value);@@ -365,6 +367,7 @@ ${prompt.trim()}`;{/* Model */}{filterSelectableModels(currentProvider?.models).length > 0 && (<select+ aria-label="Model"value={selectedModel}onChange={(e) => setSelectedModel(e.target.value)}className="px-3 py-2 bg-port-bg border border-port-border rounded-lg text-white text-sm"@@ -379,6 +382,7 @@ ${prompt.trim()}`;<div className="flex items-center gap-2"><Clock size={16} className="text-gray-400" /><select+ aria-label="Timeout"value={timeout}onChange={(e) => setTimeout(Number(e.target.value))}className="px-3 py-2 bg-port-bg border border-port-border rounded-lg text-white text-sm"@@ -440,6 +444,7 @@ ${prompt.trim()}`;<textareavalue={prompt}onChange={(e) => setPrompt(e.target.value)}+ aria-label="AI prompt"placeholder="Describe what you want the AI to do..."rows={3}className="flex-1 px-3 sm:px-4 py-3 bg-port-bg border border-port-border rounded-lg text-white focus:border-port-accent focus:outline-hidden resize-none text-sm sm:text-base"@@ -469,6 +474,7 @@ ${prompt.trim()}`;value={command}onChange={(e) => setCommand(e.target.value)}onKeyDown={(e) => e.key === 'Enter' && !running && handleRunCommand()}+ aria-label="Command to run"placeholder="Enter command (e.g., npm run build)"className="flex-1 px-3 sm:px-4 py-3 bg-port-bg border border-port-border rounded-lg text-white font-mono focus:border-port-accent focus:outline-hidden text-sm sm:text-base"/>diff --git a/client/src/pages/Sharing.jsx b/client/src/pages/Sharing.jsxindex 4f09409021..ad2a499759 100644--- a/client/src/pages/Sharing.jsx+++ b/client/src/pages/Sharing.jsx@@ -663,9 +663,11 @@ function SettingsPanel({ bucket, onToggleMode, onRequestDelete, onConfirmDelete,<span className={`text-sm ${bucket.mode === 'inbox' ? 'text-white' : 'text-gray-500'}`}>Inbox (review)</span><buttontype="button"+ role="switch"+ aria-checked={bucket.mode === 'auto-merge'}onClick={onToggleMode}className={`relative inline-flex h-5 w-9 items-center rounded-full transition-colors ${bucket.mode === 'auto-merge' ? 'bg-port-accent' : 'bg-port-border'}`}- aria-label="Toggle mode"+ aria-label="Auto-merge incoming records (off queues them in the inbox for review)"><span className={`inline-block h-3 w-3 transform rounded-full bg-white transition-transform ${bucket.mode === 'auto-merge' ? 'translate-x-5' : 'translate-x-1'}`} /></button>diff --git a/client/src/pages/SongBook.jsx b/client/src/pages/SongBook.jsxindex 4d73fdb314..d89a585c1c 100644--- a/client/src/pages/SongBook.jsx+++ b/client/src/pages/SongBook.jsx@@ -229,7 +229,7 @@ export default function SongBook() {value={song.stage || 'new'}onChange={(e) => onStageChange(song.id, e.target.value)}aria-label={`Stage for ${song.title}`}- className={`text-xs rounded-full border px-2 py-1 focus:outline-none ${SONG_STAGE_COLORS[song.stage] || SONG_STAGE_COLORS.new}`}+ className={`text-xs rounded-full border px-2 py-1 focus:outline-none focus-visible:ring-2 focus-visible:ring-port-accent ${SONG_STAGE_COLORS[song.stage] || SONG_STAGE_COLORS.new}`}>{SONG_STAGES.map((s) => <option key={s.id} value={s.id} className="bg-port-card text-white">{s.label}</option>)}</select>diff --git a/client/src/pages/SongBookViewer.jsx b/client/src/pages/SongBookViewer.jsxindex 1f7e1d006f..711934b112 100644--- a/client/src/pages/SongBookViewer.jsx+++ b/client/src/pages/SongBookViewer.jsx@@ -562,7 +562,7 @@ export default function SongBookViewer() {id="song-stage"value={song.stage || 'new'}onChange={(e) => onStageChange(e.target.value)}- className={`text-xs rounded-full border px-2 py-2 min-h-[44px] focus:outline-none ${stageClass}`}+ className={`text-xs rounded-full border px-2 py-2 min-h-[44px] focus:outline-none focus-visible:ring-2 focus-visible:ring-port-accent ${stageClass}`}>{SONG_STAGES.map((s) => <option key={s.id} value={s.id} className="bg-port-card text-white">{s.label}</option>)}</select>diff --git a/client/src/pages/Sprites.jsx b/client/src/pages/Sprites.jsxindex 3fa0a8f9ef..433b43df29 100644--- a/client/src/pages/Sprites.jsx+++ b/client/src/pages/Sprites.jsx@@ -2,6 +2,7 @@ import { useEffect, useState, useCallback, useMemo } from 'react';import { useParams, useNavigate } from 'react-router-dom';import { PersonStanding, Package, Download, FolderOpen, X, RefreshCw, Plus } from 'lucide-react';import toast from '../components/ui/Toast';+import Modal from '../components/ui/Modal.jsx';import { listSpriteRecords, getSpriteRecord, importSprites, createSpriteRecord } from '../services/apiSprites.js';import { getApps } from '../services/apiApps.js';import AppContextPicker from '../components/AppContextPicker.jsx';@@ -279,19 +280,27 @@ function AssetGroups({ recordId, assets }) {</div></div>))}- {preview && (- <div- className="fixed inset-0 z-50 bg-black/80 flex items-center justify-center p-4"- role="dialog"- aria-label={`Preview ${preview.path}`}+ {/* Shared Modal for the lightbox: Esc-to-close, focus trap, and+ focus restore to the thumbnail that opened it — the hand-rolled+ overlay this replaced was click-to-dismiss only. */}+ <Modal+ open={!!preview}+ onClose={() => setPreview(null)}+ size="none"+ backdropClassName="bg-black/80"+ ariaLabel={preview ? `Preview ${preview.path}` : undefined}+ panelClassName="max-w-full max-h-full"+ >+ <img src={preview?.url} alt={preview?.path || ''} className="max-w-full max-h-[85vh] object-contain" style={{ imageRendering: 'pixelated' }} />+ <p className="text-center text-xs text-gray-400 mt-2">{preview?.path}</p>+ <button+ type="button"onClick={() => setPreview(null)}+ className="sr-only focus:not-sr-only focus:absolute focus:top-2 focus:right-2 focus:bg-port-card focus:text-white focus:px-3 focus:py-1 focus:rounded">- <div className="max-w-full max-h-full">- <img src={preview.url} alt={preview.path} className="max-w-full max-h-[85vh] object-contain" style={{ imageRendering: 'pixelated' }} />- <p className="text-center text-xs text-gray-400 mt-2">{preview.path}</p>- </div>- </div>- )}+ Close preview+ </button>+ </Modal></div>);}diff --git a/client/src/pages/Tribe.jsx b/client/src/pages/Tribe.jsxindex 829820c2fc..bc4ee85232 100644--- a/client/src/pages/Tribe.jsx+++ b/client/src/pages/Tribe.jsx@@ -424,6 +424,7 @@ function MemoryLinksPanel({ personId }) {</div><div className="mt-3 grid gap-2"><select+ aria-label="Brain memory"value={memoryId}onChange={(event) => setMemoryId(event.target.value)}className="w-full rounded border border-port-border bg-port-bg px-3 py-2 text-sm text-white outline-none focus:border-port-accent"@@ -436,6 +437,7 @@ function MemoryLinksPanel({ personId }) {<inputvalue={note}onChange={(event) => setNote(event.target.value)}+ aria-label="Why this memory matters"className="w-full rounded border border-port-border bg-port-bg px-3 py-2 text-sm text-white outline-none focus:border-port-accent"placeholder="Why this memory matters"/>diff --git a/client/src/pages/Wiki.jsx b/client/src/pages/Wiki.jsxindex 2f3eaf35d2..9023a2f5e8 100644--- a/client/src/pages/Wiki.jsx+++ b/client/src/pages/Wiki.jsx@@ -181,6 +181,7 @@ export default function Wiki() {<span className="text-sm text-gray-500">{stats.rawSources} sources</span>{vaults.length > 1 && (<select+ aria-label="Vault"value={selectedVaultId || ''}onChange={e => selectVault(e.target.value)}className="bg-port-bg border border-port-border rounded px-2 py-1 text-sm text-white"