Skip to content

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

address codex review: scope aria-controls to the mounted panel, make the panel a tab stop

[._.]/ Adam Eivy71169ae81062
diff --git a/client/src/components/city/CityIntelPane.jsx b/client/src/components/city/CityIntelPane.jsx
index 2b0ccbf489..9bd7a76de8 100644
--- a/client/src/components/city/CityIntelPane.jsx
+++ b/client/src/components/city/CityIntelPane.jsx
@@ -416,7 +416,10 @@ export default function CityIntelPane({ apps, cosAgents, reviewCounts, instances
role="tab"
id={`city-intel-tab-${t.id}`}
aria-selected={active}
- aria-controls={collapsed ? undefined : `city-intel-panel-${t.id}`}
+ // Only one panel is mounted at a time, so only the selected tab
+ // owns an `aria-controls` — an inactive tab would otherwise point
+ // at an element that doesn't exist.
+ aria-controls={active && !collapsed ? `city-intel-panel-${t.id}` : undefined}
tabIndex={active ? 0 : -1}
onKeyDown={onTabKeyDown}
onClick={() => selectTab(t.id)}
@@ -456,7 +459,10 @@ export default function CityIntelPane({ apps, cosAgents, reviewCounts, instances
role="tabpanel"
id={`city-intel-panel-${tab}`}
aria-labelledby={`city-intel-tab-${tab}`}
- className="flex-1 min-h-0 flex flex-col"
+ // An empty tab renders no focusable children, so the panel itself has to
+ // be a tab stop or keyboard users can't reach its content at all.
+ tabIndex={0}
+ className="flex-1 min-h-0 flex flex-col focus:outline-none focus-visible:ring-1 focus-visible:ring-cyan-400/60"
>
<CityIntelContent tab={tab} items={items} eventLogs={eventLogs} />
</div>
diff --git a/client/src/components/city/CityIntelPane.test.jsx b/client/src/components/city/CityIntelPane.test.jsx
index edbe558028..fcf2e09bb4 100644
--- a/client/src/components/city/CityIntelPane.test.jsx
+++ b/client/src/components/city/CityIntelPane.test.jsx
@@ -33,21 +33,26 @@ describe('CityIntelPane tab bar', () => {
const panel = screen.getByRole('tabpanel');
expect(attention.getAttribute('aria-controls')).toBe(panel.id);
expect(panel.getAttribute('aria-labelledby')).toBe(attention.id);
+ // Only one panel is mounted, so an unselected tab must not point at a
+ // nonexistent element.
+ expect(timeline).not.toHaveAttribute('aria-controls');
+ // An empty panel has no focusable children — it must be its own tab stop.
+ expect(panel).toHaveAttribute('tabindex', '0');
});
- it('moves selection with arrow keys and wraps, and jumps with Home/End', () => {
+ it('moves selection and focus with arrow keys and wraps, and jumps with Home/End', () => {
renderPane();
const tabs = () => screen.getAllByRole('tab');
- fireEvent.keyDown(tabs()[0], { key: 'ArrowRight' });
- expect(tabs()[1]).toHaveAttribute('aria-selected', 'true');
- fireEvent.keyDown(tabs()[1], { key: 'End' });
- expect(tabs()[2]).toHaveAttribute('aria-selected', 'true');
- fireEvent.keyDown(tabs()[2], { key: 'ArrowRight' });
- expect(tabs()[0]).toHaveAttribute('aria-selected', 'true');
- fireEvent.keyDown(tabs()[0], { key: 'ArrowLeft' });
- expect(tabs()[2]).toHaveAttribute('aria-selected', 'true');
- fireEvent.keyDown(tabs()[2], { key: 'Home' });
- expect(tabs()[0]).toHaveAttribute('aria-selected', 'true');
+ const step = (from, key, to) => {
+ fireEvent.keyDown(tabs()[from], { key });
+ expect(tabs()[to]).toHaveAttribute('aria-selected', 'true');
+ expect(document.activeElement).toBe(tabs()[to]);
+ };
+ step(0, 'ArrowRight', 1);
+ step(1, 'End', 2);
+ step(2, 'ArrowRight', 0); // wraps forward
+ step(0, 'ArrowLeft', 2); // wraps backward
+ step(2, 'Home', 0);
});
it('collapses the panel and drops the stale aria-controls reference', () => {