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([issue-1090]): give GitTab modals dialog roles + Escape/close affordance
Adam Eivy554f0a02cbb1
diff --git a/client/src/components/apps/tabs/GitTab.jsx b/client/src/components/apps/tabs/GitTab.jsxindex 7b9909f154..371d94445b 100644--- a/client/src/components/apps/tabs/GitTab.jsx+++ b/client/src/components/apps/tabs/GitTab.jsx@@ -1,6 +1,7 @@import { useState, useEffect, useCallback } from 'react';import { GitBranch, Plus, Minus, FileText, RefreshCw, Download, Rocket, Upload, ArrowUpDown, Check, Trash2, GitMerge, Globe } from 'lucide-react';import toast from '../../ui/Toast';+import Modal from '../../ui/Modal';import BrailleSpinner from '../../BrailleSpinner';import * as api from '../../../services/api';@@ -801,71 +802,77 @@ export default function GitTab({ appId: _appId, appName, repoPath }) {)}{/* Diff Modal */}- {showDiff && (- <div className="fixed inset-0 bg-black/50 flex items-center justify-center z-50" onClick={() => setShowDiff(false)}>- <div className="bg-port-card border border-port-border rounded-xl w-3/4 max-h-[80vh] overflow-hidden" onClick={e => e.stopPropagation()}>- <div className="flex items-center justify-between p-4 border-b border-port-border">- <h3 className="font-medium text-white">Git Diff</h3>- <button onClick={() => setShowDiff(false)} className="text-gray-400 hover:text-white">×</button>- </div>- <pre className="p-4 overflow-auto max-h-[70vh] text-sm font-mono">- {diff.split('\n').map((line, i) => {- let color = 'text-gray-300';- if (line.startsWith('+') && !line.startsWith('+++')) color = 'text-port-success';- if (line.startsWith('-') && !line.startsWith('---')) color = 'text-port-error';- if (line.startsWith('@@')) color = 'text-port-accent';- return <div key={i} className={color}>{line}</div>;- })}- {!diff && <span className="text-gray-500">No changes to display</span>}- </pre>- </div>+ <Modal+ open={showDiff}+ onClose={() => setShowDiff(false)}+ size="none"+ backdropClassName="bg-black/50"+ panelClassName="bg-port-card border border-port-border rounded-xl w-3/4 max-h-[80vh] overflow-hidden"+ ariaLabelledBy="git-diff-modal-title"+ >+ <div className="flex items-center justify-between p-4 border-b border-port-border">+ <h3 id="git-diff-modal-title" className="font-medium text-white">Git Diff</h3>+ <button onClick={() => setShowDiff(false)} aria-label="Close" className="text-gray-400 hover:text-white">×</button></div>- )}+ <pre className="p-4 overflow-auto max-h-[70vh] text-sm font-mono">+ {diff.split('\n').map((line, i) => {+ let color = 'text-gray-300';+ if (line.startsWith('+') && !line.startsWith('+++')) color = 'text-port-success';+ if (line.startsWith('-') && !line.startsWith('---')) color = 'text-port-error';+ if (line.startsWith('@@')) color = 'text-port-accent';+ return <div key={i} className={color}>{line}</div>;+ })}+ {!diff && <span className="text-gray-500">No changes to display</span>}+ </pre>+ </Modal>{/* Release Confirmation Dialog */}- {showReleaseConfirm && (- <div className="fixed inset-0 bg-black/50 flex items-center justify-center z-50" onClick={() => setShowReleaseConfirm(false)}>- <div className="bg-port-card border border-port-border rounded-xl w-full max-w-lg overflow-hidden" onClick={e => e.stopPropagation()}>- <div className="flex items-center justify-between p-4 border-b border-port-border">- <h3 className="font-medium text-white flex items-center gap-2">- <Rocket size={18} className="text-port-accent" />- Create Release PR for {appName}- </h3>- <button onClick={() => setShowReleaseConfirm(false)} className="text-gray-400 hover:text-white">×</button>- </div>- <div className="p-4 space-y-3">- <p className="text-sm text-gray-300">- This will create a CoS agent task to automate the full release workflow:- </p>- <ul className="text-sm text-gray-400 space-y-1.5 ml-4 list-disc">- <li>Push local commits to origin/{gitInfo?.devBranch || 'dev'}</li>- {gitInfo?.hasChangelog && <li>Check and update the changelog</li>}- <li>Create PR from {gitInfo?.devBranch || 'dev'} to {gitInfo?.baseBranch || 'main'}</li>- <li>Wait for Copilot review and address feedback</li>- <li>Merge when approved and CI passes</li>- </ul>- <p className="text-xs text-gray-500">- {branchComparison?.ahead || 0} commits will be included in this release.- </p>- </div>- <div className="flex justify-end gap-3 p-4 border-t border-port-border">- <button- onClick={() => setShowReleaseConfirm(false)}- className="px-4 py-2 text-sm text-gray-400 hover:text-white"- >- Cancel- </button>- <button- onClick={handleReleasePR}- className="flex items-center gap-2 px-4 py-2 bg-port-accent hover:bg-port-accent/80 text-white rounded-lg text-sm"- >- <Rocket size={16} />- Start Release- </button>- </div>- </div>+ <Modal+ open={showReleaseConfirm}+ onClose={() => setShowReleaseConfirm(false)}+ size="md"+ backdropClassName="bg-black/50"+ panelClassName="bg-port-card border border-port-border rounded-xl overflow-hidden"+ ariaLabelledBy="git-release-modal-title"+ >+ <div className="flex items-center justify-between p-4 border-b border-port-border">+ <h3 id="git-release-modal-title" className="font-medium text-white flex items-center gap-2">+ <Rocket size={18} className="text-port-accent" />+ Create Release PR for {appName}+ </h3>+ <button onClick={() => setShowReleaseConfirm(false)} aria-label="Close" className="text-gray-400 hover:text-white">×</button></div>- )}+ <div className="p-4 space-y-3">+ <p className="text-sm text-gray-300">+ This will create a CoS agent task to automate the full release workflow:+ </p>+ <ul className="text-sm text-gray-400 space-y-1.5 ml-4 list-disc">+ <li>Push local commits to origin/{gitInfo?.devBranch || 'dev'}</li>+ {gitInfo?.hasChangelog && <li>Check and update the changelog</li>}+ <li>Create PR from {gitInfo?.devBranch || 'dev'} to {gitInfo?.baseBranch || 'main'}</li>+ <li>Wait for Copilot review and address feedback</li>+ <li>Merge when approved and CI passes</li>+ </ul>+ <p className="text-xs text-gray-500">+ {branchComparison?.ahead || 0} commits will be included in this release.+ </p>+ </div>+ <div className="flex justify-end gap-3 p-4 border-t border-port-border">+ <button+ onClick={() => setShowReleaseConfirm(false)}+ className="px-4 py-2 text-sm text-gray-400 hover:text-white"+ >+ Cancel+ </button>+ <button+ onClick={handleReleasePR}+ className="flex items-center gap-2 px-4 py-2 bg-port-accent hover:bg-port-accent/80 text-white rounded-lg text-sm"+ >+ <Rocket size={16} />+ Start Release+ </button>+ </div>+ </Modal></div>);}diff --git a/client/src/components/ui/Modal.test.jsx b/client/src/components/ui/Modal.test.jsxnew file mode 100644index 0000000000..4892bf2226--- /dev/null+++ b/client/src/components/ui/Modal.test.jsx@@ -0,0 +1,55 @@+import { describe, it, expect, vi, afterEach } from 'vitest';+import { render, screen, fireEvent, cleanup } from '@testing-library/react';++import Modal from './Modal';++afterEach(cleanup);++describe('Modal accessibility', () => {+ it('renders the panel as an accessible dialog over a presentation backdrop', () => {+ render(+ <Modal open onClose={() => {}} ariaLabel="Test dialog">+ <p>body</p>+ </Modal>+ );+ const dialog = screen.getByRole('dialog');+ expect(dialog).toHaveAttribute('aria-modal', 'true');+ expect(dialog).toHaveAttribute('aria-label', 'Test dialog');+ // Backdrop is the dialog's parent and must be presentation-only so it+ // isn't announced as interactive content.+ expect(dialog.parentElement).toHaveAttribute('role', 'presentation');+ });++ it('labels the dialog via ariaLabelledBy (no redundant aria-label)', () => {+ render(+ <Modal open onClose={() => {}} ariaLabelledBy="title-id">+ <h3 id="title-id">My Title</h3>+ </Modal>+ );+ const dialog = screen.getByRole('dialog');+ expect(dialog).toHaveAttribute('aria-labelledby', 'title-id');+ expect(dialog).not.toHaveAttribute('aria-label');+ });++ it('closes on Escape by default', () => {+ const onClose = vi.fn();+ render(<Modal open onClose={onClose} ariaLabel="x"><p>body</p></Modal>);+ fireEvent.keyDown(window, { key: 'Escape' });+ expect(onClose).toHaveBeenCalledTimes(1);+ });++ it('closes on backdrop click but not on panel click', () => {+ const onClose = vi.fn();+ render(<Modal open onClose={onClose} ariaLabel="x"><p>body</p></Modal>);+ const dialog = screen.getByRole('dialog');+ fireEvent.click(screen.getByText('body'));+ expect(onClose).not.toHaveBeenCalled();+ fireEvent.click(dialog.parentElement);+ expect(onClose).toHaveBeenCalledTimes(1);+ });++ it('renders nothing while closed', () => {+ render(<Modal open={false} onClose={() => {}} ariaLabel="x"><p>body</p></Modal>);+ expect(screen.queryByRole('dialog')).toBeNull();+ });+});