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
fix(a11y): un-nest four interactive controls that were mouse-only inside another button or link
[._.]/ Adam Eivy0367a55e03e1
diff --git a/client/src/components/cos/tabs/GsdProjectCard.jsx b/client/src/components/cos/tabs/GsdProjectCard.jsxindex dbc4c500a6..011e56cda7 100644--- a/client/src/components/cos/tabs/GsdProjectCard.jsx+++ b/client/src/components/cos/tabs/GsdProjectCard.jsx@@ -32,32 +32,34 @@ export default function GsdProjectCard({ project, onRefresh }) {return (<div className="bg-port-card border border-port-border rounded-lg overflow-hidden">- <button- onClick={handleExpand}- className="flex items-center justify-between w-full px-4 py-3 text-left hover:bg-white/5 transition-colors"- >- <div className="flex items-center gap-3 min-w-0">+ {/* The Dashboard link is a SIBLING of the expand button, not a child: a+ <Link> renders an <a>, and an <a> inside a <button> is invalid HTML+ that kept it out of the tab order (it needed stopPropagation to+ suppress the expand it shouldn't have triggered). The button still+ covers the rest of the row, so clicking anywhere else expands. */}+ <div className="flex items-center gap-2 w-full px-4 py-3 hover:bg-white/5 transition-colors">+ <button+ onClick={handleExpand}+ className="flex items-center gap-3 flex-1 min-w-0 text-left"+ ><span className="text-sm font-semibold text-white truncate">{project.appName}</span>{project.hasRoadmap && (<span className="text-xs text-gray-500 font-mono shrink-0">{completedPhases}/{phaseCount} phases</span>)}- </div>- <div className="flex items-center gap-2">- <Link- to={`/apps/${project.appId}/gsd`}- onClick={e => e.stopPropagation()}- className="text-[10px] px-1.5 py-0.5 rounded bg-port-accent/20 text-port-accent hover:bg-port-accent/30 flex items-center gap-1"- >- Dashboard <ExternalLink size={10} />- </Link>- {project.hasConcerns && (- <span className="text-[10px] px-1.5 py-0.5 rounded bg-port-warning/20 text-port-warning">concerns</span>- )}- {expanded ? <ChevronUp size={16} className="text-gray-500" /> : <ChevronDown size={16} className="text-gray-500" />}- </div>- </button>+ </button>+ <Link+ to={`/apps/${project.appId}/gsd`}+ className="text-[10px] px-1.5 py-0.5 rounded bg-port-accent/20 text-port-accent hover:bg-port-accent/30 flex items-center gap-1 shrink-0"+ >+ Dashboard <ExternalLink size={10} />+ </Link>+ {project.hasConcerns && (+ <span className="text-[10px] px-1.5 py-0.5 rounded bg-port-warning/20 text-port-warning shrink-0">concerns</span>+ )}+ {expanded ? <ChevronUp size={16} className="text-gray-500 shrink-0" /> : <ChevronDown size={16} className="text-gray-500 shrink-0" />}+ </div>{expanded && (<div className="px-4 pb-4 border-t border-port-border/50 pt-3 space-y-4">diff --git a/client/src/components/cos/tabs/GsdProjectCard.test.jsx b/client/src/components/cos/tabs/GsdProjectCard.test.jsxnew file mode 100644index 0000000000..5f4ab559dc--- /dev/null+++ b/client/src/components/cos/tabs/GsdProjectCard.test.jsx@@ -0,0 +1,44 @@+import { describe, it, expect, vi } from 'vitest';+import { render, screen, fireEvent } from '@testing-library/react';+import { MemoryRouter } from 'react-router-dom';++vi.mock('../../../services/api', () => ({+ getGsdProject: vi.fn().mockResolvedValue({ phases: [] }),+}));++import GsdProjectCard from './GsdProjectCard';++const PROJECT = { appId: 'example-app', appName: 'Example App', hasRoadmap: true, hasConcerns: false };++const renderCard = () => render(+ <MemoryRouter>+ <GsdProjectCard project={PROJECT} onRefresh={() => {}} />+ </MemoryRouter>,+);++// The Dashboard link used to render INSIDE the expand <button>. A <Link> is an+// <a>, and an <a> inside a <button> is invalid HTML that drops the link from the+// tab order — it also had to call stopPropagation to suppress the expand it+// should never have triggered. The two are siblings now.+describe('GsdProjectCard header row (nested-interactive regression)', () => {+ it('does not nest the Dashboard link inside the expand button', () => {+ const { container } = renderCard();+ const nested = [...container.querySelectorAll('button, a')]+ .filter((el) => el.querySelector('button, a'));+ expect(nested).toEqual([]);+ });++ it('keeps the Dashboard link focusable and pointing at the app', () => {+ renderCard();+ const link = screen.getByRole('link', { name: /dashboard/i });+ expect(link).toHaveAttribute('href', '/apps/example-app/gsd');+ link.focus();+ expect(document.activeElement).toBe(link);+ });++ it('still expands when the row itself is clicked', async () => {+ renderCard();+ fireEvent.click(screen.getByText('Example App'));+ expect(await screen.findByText('No phases found')).toBeInTheDocument();+ });+});diff --git a/client/src/components/gsd/PhaseCard.jsx b/client/src/components/gsd/PhaseCard.jsxindex e7b0cb5e9e..2cdbfb2f83 100644--- a/client/src/components/gsd/PhaseCard.jsx+++ b/client/src/components/gsd/PhaseCard.jsx@@ -41,8 +41,9 @@ export default function PhaseCard({ phase, pendingAction, appId, expanded, onTogconst actionCfg = pendingAction ? ACTION_CONFIG[pendingAction.nextAction] : null;const progressPct = phase.totalTasks > 0 ? (phase.completedTasks / phase.totalTasks) * 100 : 0;- const handleTriggerAction = async (e) => {- e.stopPropagation();+ // No stopPropagation needed — this button is a sibling of the row toggle, not+ // a descendant, so its click never reaches the expand handler.+ const handleTriggerAction = async () => {if (!pendingAction) return;setTriggeringAction(true);const result = await api.triggerGsdPhaseAction(appId, phase.id, pendingAction.nextAction).catch(() => null);@@ -54,43 +55,49 @@ export default function PhaseCard({ phase, pendingAction, appId, expanded, onTogreturn (<div className="bg-port-card border border-port-border rounded-lg overflow-hidden">- {/* Collapsed row */}- <button- onClick={onToggle}- className="w-full flex items-center gap-3 p-3 hover:bg-port-border/20 transition-colors text-left"- >- {expanded ? <ChevronDown size={14} className="text-gray-500 shrink-0" /> : <ChevronRight size={14} className="text-gray-500 shrink-0" />}- <div className={`w-2.5 h-2.5 rounded-full shrink-0 ${statusCfg.color}`} title={statusCfg.label} />- <span className="text-xs text-gray-500 font-mono w-6 shrink-0">{num}</span>- <span className="text-sm text-gray-200 truncate flex-1">{name || phase.id}</span>-- {/* Progress bar */}- {phase.totalTasks > 0 && (- <div className="w-20 flex items-center gap-1.5 shrink-0">- <div className="flex-1 h-1 bg-port-bg rounded-full overflow-hidden">- <div className="h-full bg-port-success rounded-full" style={{ width: `${progressPct}%` }} />+ {/* Collapsed row. The "next action" button is a SIBLING of the toggle,+ not a child — a <button> nested in a <button> is invalid HTML and left+ the action unreachable by keyboard. The toggle still fills the rest of+ the row, so clicking anywhere but the action expands the phase. */}+ <div className="w-full flex items-center gap-3 p-3 hover:bg-port-border/20 transition-colors">+ <button+ onClick={onToggle}+ className="flex items-center gap-3 flex-1 min-w-0 text-left"+ >+ {expanded ? <ChevronDown size={14} className="text-gray-500 shrink-0" /> : <ChevronRight size={14} className="text-gray-500 shrink-0" />}+ <div className={`w-2.5 h-2.5 rounded-full shrink-0 ${statusCfg.color}`} title={statusCfg.label} />+ <span className="text-xs text-gray-500 font-mono w-6 shrink-0">{num}</span>+ <span className="text-sm text-gray-200 truncate flex-1">{name || phase.id}</span>++ {/* Progress bar */}+ {phase.totalTasks > 0 && (+ <div className="w-20 flex items-center gap-1.5 shrink-0">+ <div className="flex-1 h-1 bg-port-bg rounded-full overflow-hidden">+ <div className="h-full bg-port-success rounded-full" style={{ width: `${progressPct}%` }} />+ </div>+ <span className="text-xs text-gray-500 w-8 text-right">{phase.completedTasks}/{phase.totalTasks}</span></div>- <span className="text-xs text-gray-500 w-8 text-right">{phase.completedTasks}/{phase.totalTasks}</span>- </div>- )}+ )}- {/* Plan count badge */}- {phase.plans?.length > 0 && (- <span className="px-1.5 py-0.5 bg-port-bg border border-port-border rounded text-xs text-gray-400 shrink-0">- {phase.plans.length} plan{phase.plans.length > 1 ? 's' : ''}- </span>- )}+ {/* Plan count badge */}+ {phase.plans?.length > 0 && (+ <span className="px-1.5 py-0.5 bg-port-bg border border-port-border rounded text-xs text-gray-400 shrink-0">+ {phase.plans.length} plan{phase.plans.length > 1 ? 's' : ''}+ </span>+ )}- {/* Verification badge */}- {phase.verification && (- <span className={`px-1.5 py-0.5 rounded text-xs shrink-0 ${- phase.verification.status === 'passed'- ? 'bg-port-success/20 text-port-success'- : 'bg-port-warning/20 text-port-warning'- }`}>- {phase.verification.score != null ? `${phase.verification.score}/10` : phase.verification.status}- </span>- )}+ {/* Verification badge */}+ {phase.verification && (+ <span className={`px-1.5 py-0.5 rounded text-xs shrink-0 ${+ phase.verification.status === 'passed'+ ? 'bg-port-success/20 text-port-success'+ : 'bg-port-warning/20 text-port-warning'+ }`}>+ {phase.verification.score != null ? `${phase.verification.score}/10` : phase.verification.status}+ </span>+ )}++ </button>{/* Next action button */}{actionCfg && (@@ -102,7 +109,7 @@ export default function PhaseCard({ phase, pendingAction, appId, expanded, onTog<actionCfg.icon size={12} /> {triggeringAction ? 'Creating...' : actionCfg.label}</button>)}- </button>+ </div>{/* Expanded detail */}{expanded && (diff --git a/client/src/components/gsd/PhaseCard.test.jsx b/client/src/components/gsd/PhaseCard.test.jsxnew file mode 100644index 0000000000..7d2b26b50b--- /dev/null+++ b/client/src/components/gsd/PhaseCard.test.jsx@@ -0,0 +1,60 @@+import { describe, it, expect, vi } from 'vitest';+import { render, screen, fireEvent, act } from '@testing-library/react';++vi.mock('../../services/api', () => ({+ triggerGsdPhaseAction: vi.fn().mockResolvedValue({ ok: true }),+}));++import PhaseCard from './PhaseCard';++const PHASE = {+ id: '03-apple-health-integration',+ totalTasks: 4,+ completedTasks: 2,+ plans: [],+};++const renderCard = (props = {}) => render(+ <PhaseCard+ phase={PHASE}+ pendingAction={{ currentStep: 'planned', nextAction: 'execute' }}+ appId="example-app"+ expanded={false}+ onToggle={() => {}}+ {...props}+ />,+);++// The collapsed row is a toggle <button>, and the "next action" button used to+// be rendered INSIDE it. A <button> nested in a <button> is invalid HTML: the+// inner control is dropped from the tab order, so Execute/Plan/Verify could+// only ever be reached with a mouse. The two are siblings now.+describe('PhaseCard collapsed row (nested-interactive regression)', () => {+ it('does not nest the action button inside the toggle button', () => {+ const { container } = renderCard();+ const nested = [...container.querySelectorAll('button, a')]+ .filter((el) => el.querySelector('button, a'));+ expect(nested).toEqual([]);+ });++ it('keeps the action button focusable and clickable without toggling the row', async () => {+ const onToggle = vi.fn();+ renderCard({ onToggle });++ const action = screen.getByRole('button', { name: /execute/i });+ action.focus();+ expect(document.activeElement).toBe(action);++ // The handler awaits triggerGsdPhaseAction, so settle it inside act().+ await act(async () => { fireEvent.click(action); });+ // Sibling, not descendant — the click must not reach the row toggle.+ expect(onToggle).not.toHaveBeenCalled();+ });++ it('still expands when the row itself is clicked', () => {+ const onToggle = vi.fn();+ renderCard({ onToggle });+ fireEvent.click(screen.getByText('Apple Health Integration'));+ expect(onToggle).toHaveBeenCalledTimes(1);+ });+});diff --git a/client/src/components/media/MediaCard.jsx b/client/src/components/media/MediaCard.jsxindex b36454dd2c..6858ef6440 100644--- a/client/src/components/media/MediaCard.jsx+++ b/client/src/components/media/MediaCard.jsx@@ -41,31 +41,38 @@ export default function MediaCard({return (<div className={`bg-port-card border rounded-xl ${selected ? 'border-port-accent' : 'border-port-border'}`}>- <button- type="button"- onClick={() => handleTileClick(item)}- disabled={disabled}- className="block w-full aspect-square bg-port-bg relative rounded-t-xl overflow-hidden disabled:cursor-not-allowed disabled:opacity-40"- >- {previewUrl ? (- <MediaImage src={previewUrl} alt={prompt} className="w-full h-full object-cover" loading="lazy" />- ) : (- <div className="w-full h-full flex items-center justify-center text-gray-600">- {isVideo ? <Film className="w-10 h-10" /> : <ImageIcon className="w-10 h-10" />}- </div>- )}+ {/* The tile is a button, so the star toggle cannot live inside it — a+ <button> nested in a <button> is invalid HTML and keeps the inner+ control out of the tab order. Tile and overlays are siblings in this+ positioned wrapper instead, with the overlays click-through so the+ tile stays clickable behind them. */}+ <div className="relative aspect-square rounded-t-xl overflow-hidden bg-port-bg">+ <button+ type="button"+ onClick={() => handleTileClick(item)}+ disabled={disabled}+ className="block w-full h-full disabled:cursor-not-allowed disabled:opacity-40"+ >+ {previewUrl ? (+ <MediaImage src={previewUrl} alt={prompt} className="w-full h-full object-cover" loading="lazy" />+ ) : (+ <div className="w-full h-full flex items-center justify-center text-gray-600">+ {isVideo ? <Film className="w-10 h-10" /> : <ImageIcon className="w-10 h-10" />}+ </div>+ )}+ </button>{selectionLabel != null && (- <div className="absolute top-1.5 left-1.5 w-5 h-5 rounded-full bg-port-accent text-white text-[10px] font-bold flex items-center justify-center">+ <div className="absolute top-1.5 left-1.5 w-5 h-5 rounded-full bg-port-accent text-white text-[10px] font-bold flex items-center justify-center pointer-events-none">{selectionLabel}</div>)}{(onToggleStar || starred || hasNote) && (- <div className="absolute bottom-1.5 left-1.5 flex items-center gap-1">+ <div className="absolute bottom-1.5 left-1.5 flex items-center gap-1 pointer-events-none">{onToggleStar && (<buttontype="button"- onClick={(e) => { e.stopPropagation(); onToggleStar(item); }}- className={`p-1 rounded-full ${starred ? 'bg-port-warning/90 text-black' : 'bg-black/50 text-white/70 hover:text-white'}`}+ onClick={() => onToggleStar(item)}+ className={`pointer-events-auto p-1 rounded-full ${starred ? 'bg-port-warning/90 text-black' : 'bg-black/50 text-white/70 hover:text-white'}`}title={starred ? 'Unfavorite' : 'Favorite'}aria-label={starred ? 'Unfavorite' : 'Favorite'}>@@ -74,7 +81,7 @@ export default function MediaCard({)}{hasNote && (<span- className="p-1 rounded-full bg-port-accent/80 text-white"+ className="pointer-events-auto p-1 rounded-full bg-port-accent/80 text-white"title="Has note"aria-label="Has note">@@ -83,16 +90,19 @@ export default function MediaCard({)}</div>)}- <div className="absolute top-1.5 right-1.5 flex flex-col items-end gap-0.5">+ {/* The container is click-through so the tile stays clickable behind it,+ but each badge takes pointer events back — a `title` tooltip needs+ them, and these badges are the only thing explaining "frame". */}+ <div className="absolute top-1.5 right-1.5 flex flex-col items-end gap-0.5 pointer-events-none">{[item.stitchedFrom && { label: 'stitched', cls: 'bg-port-success/80 text-white' },item.upscaledFrom && { label: '2×', cls: 'bg-port-accent/80 text-white' },item.extractedFromVideoId && { label: 'frame', cls: 'bg-port-warning/80 text-black', title: 'Extracted from video' },].filter(Boolean).map((b) => (- <span key={b.label} title={b.title} className={`text-[9px] px-1 py-0.5 rounded ${b.cls}`}>{b.label}</span>+ <span key={b.label} title={b.title} className={`pointer-events-auto text-[9px] px-1 py-0.5 rounded ${b.cls}`}>{b.label}</span>))}</div>- </button>+ </div><div className="p-2 space-y-1.5"><p className="text-[11px] text-gray-300 line-clamp-2" title={prompt}>{prompt}</p><div className="flex flex-wrap gap-1 text-[9px]">diff --git a/client/src/pages/SongBook.jsx b/client/src/pages/SongBook.jsxindex d89a585c1c..4c95399a80 100644--- a/client/src/pages/SongBook.jsx+++ b/client/src/pages/SongBook.jsx@@ -202,20 +202,26 @@ export default function SongBook() {key={song.id}className="group bg-port-card border border-port-border rounded-lg flex items-start gap-3 px-4 py-3 hover:border-port-accent/50">- <Link to={`/songbook/${song.id}`} className="flex-1 min-w-0">- <div className="text-white font-medium truncate" title={song.title}>{song.title}</div>- <div className="flex flex-wrap gap-x-3 gap-y-0.5 text-xs text-gray-500 mt-1">- {song.artist && <span className="text-gray-400">{song.artist}</span>}- {song.instrument && <span>{instrumentLabel(song.instrument)}</span>}- {song.updatedAt && <span>Edited {timeAgo(song.updatedAt)}</span>}- </div>+ {/* The tag filters are buttons, so they sit BESIDE the song link,+ not inside it — a <button> inside an <a> is invalid HTML and+ left them off the tab order (they relied on preventDefault to+ suppress the navigation they shouldn't have triggered). */}+ <div className="flex-1 min-w-0">+ <Link to={`/songbook/${song.id}`} className="block">+ <div className="text-white font-medium truncate" title={song.title}>{song.title}</div>+ <div className="flex flex-wrap gap-x-3 gap-y-0.5 text-xs text-gray-500 mt-1">+ {song.artist && <span className="text-gray-400">{song.artist}</span>}+ {song.instrument && <span>{instrumentLabel(song.instrument)}</span>}+ {song.updatedAt && <span>Edited {timeAgo(song.updatedAt)}</span>}+ </div>+ </Link>{Array.isArray(song.tags) && song.tags.length > 0 && (<div className="flex flex-wrap gap-1 mt-1.5">{song.tags.map((tag) => (<buttonkey={tag}type="button"- onClick={(e) => { e.preventDefault(); setParam('tag', tag); }}+ onClick={() => setParam('tag', tag)}className="px-1.5 py-0.5 rounded-full text-[10px] bg-port-bg text-gray-400 border border-port-border hover:text-port-accent hover:border-port-accent/40">#{tag}@@ -223,7 +229,7 @@ export default function SongBook() {))}</div>)}- </Link>+ </div><div className="flex flex-col items-end gap-2 shrink-0"><selectvalue={song.stage || 'new'}