Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/web/src/components/dashboard/panels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ export function AgentsPanel({
{hasEvents && agentBackend && (
<button
onClick={() => onDispatch(video.id)}
className="px-4 py-2 text-xs font-bold uppercase tracking-wider transition-all active:scale-95 focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400/50 rounded"
className="px-4 py-2 text-xs font-bold uppercase tracking-wider transition-all active:scale-95 focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400/70 rounded"
style={{ background: 'rgba(129,140,248,0.15)', color: '#818cf8', border: '1px solid rgba(129,140,248,0.3)' }}
>
Dispatch {video.events!.length} events
Expand All @@ -232,7 +232,7 @@ export function AgentsPanel({
{anyRunning && (
<button
onClick={() => onRefresh(video.id)}
className="px-4 py-2 text-xs font-bold uppercase tracking-wider transition-all active:scale-95 focus:outline-none focus-visible:ring-2 focus-visible:ring-white/30 rounded"
className="px-4 py-2 text-xs font-bold uppercase tracking-wider transition-all active:scale-95 focus:outline-none focus-visible:ring-2 focus-visible:ring-white/40 rounded"
style={{ background: 'rgba(255,255,255,0.05)', color: 'rgba(248,245,253,0.7)', border: '1px solid rgba(255,255,255,0.1)' }}
>
Refresh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,45 @@ describe('dashboard search accessibility', () => {
expect(searchForm).not.toContain('aria-label="Submit search"');
expect(searchForm).not.toContain('aria-label="Search"');
});

it('communicates the search loading state on the Go button via aria-busy', () => {
const source = readSource('components/dashboard/panels.tsx');
const goButton = source.match(
/<button\s+type="submit"[\s\S]*?{searchLoading \? '…' : 'Go'}/,
)?.[0];

expect(goButton).toBeDefined();
expect(goButton).toContain('aria-busy={searchLoading || undefined}');
});

it('gives dashboard panel controls a visible keyboard focus state that meets the WCAG 2.2 SC 2.4.11 3:1 contrast floor', () => {
const source = readSource('components/dashboard/panels.tsx');

// Extract the specific <button> opening tag that owns a given onClick
// handler, so each assertion is bound to its own control rather than to
// the file at large. The closing `>` of a JSX opening tag sits on its own
// line here, which lets us stop at it without tripping over the `=>` in
// the arrow handler.
const buttonTagFor = (handler: string) => {
const openingTags = source.match(/<button\b[\s\S]*?\n\s*>/g) ?? [];
return openingTags.find((tag) => tag.includes(handler));
};

// Dispatch (indigo-400) and Refresh (white) rings composite against the
// ~#0e0e13 dashboard background; the opacities asserted below are the
// minimum that clear the 3:1 focus-indicator contrast ratio. Asserting on
// each button's own tag guards against a regression on one button being
// masked by the class merely existing elsewhere, and vice versa.
const dispatchButton = buttonTagFor('onDispatch(video.id)');
expect(dispatchButton).toBeDefined();
expect(dispatchButton).toContain('focus-visible:ring-2');
expect(dispatchButton).toContain('focus-visible:ring-indigo-400/70');
expect(dispatchButton).not.toContain('focus-visible:ring-indigo-400/50');

const refreshButton = buttonTagFor('onRefresh(video.id)');
expect(refreshButton).toBeDefined();
expect(refreshButton).toContain('focus-visible:ring-2');
expect(refreshButton).toContain('focus-visible:ring-white/40');
expect(refreshButton).not.toContain('focus-visible:ring-white/30');
});
Comment thread
coderabbitai[bot] marked this conversation as resolved.
});
Loading