Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

fix(ui): name the Galaxy history group and the root source button

Bernhard Jackiewicza2e140fd0f27
diff --git a/graph-ui/src/galaxy/GalaxyPanel.toolbar.test.tsx b/graph-ui/src/galaxy/GalaxyPanel.toolbar.test.tsx
index 59acccdd6..41e8d7e35 100644
--- a/graph-ui/src/galaxy/GalaxyPanel.toolbar.test.tsx
+++ b/graph-ui/src/galaxy/GalaxyPanel.toolbar.test.tsx
@@ -58,3 +58,24 @@ it('K3: the scoped toolbar keeps one row: root name opens the source, limits and
expect(bar.querySelector('select[aria-label="Trace direction"]')).not.toBeNull();
expect(bar.textContent).not.toContain('Trace');
});
+
+it('K2: the history group and the root button say what they are to assistive technology', async () => {
+ const nodes = [1, 2, 3].map(id => scopeNode(id));
+ const edges = [{ id: 1, source: 1, target: 2, type: 'CALLS' }, { id: 2, source: 3, target: 1, type: 'CALLS' }];
+ await act(async () => root.render(<GalaxyPanel project="sample" visible workspaceExpanded onOpenNode={vi.fn()} fetch={scopeFetch({ nodes, edges }).fetch} />));
+ await settle(() => expect(seam().nodes).toBe(3));
+ await act(async () => { seam().clickNode('sample.n1'); });
+ await settle(() => expect(host.querySelector('.atlas-graph-scope-count')?.textContent).toBe('3 nodes · 2 edges'));
+ await act(async () => { seam().clickNode('sample.n2'); });
+ await settle(() => expect(host.querySelector('.atlas-graph-scope-name')?.textContent).toBe('n2'));
+
+ // Back and Forward are the history, not the list of recent roots inside it.
+ const group = host.querySelector<HTMLElement>('.atlas-graph-history')!;
+ expect(group.getAttribute('role')).toBe('group');
+ expect(group.getAttribute('aria-label')).toBe('History');
+ expect(group.querySelector('ul')?.getAttribute('aria-label')).toBe('Recently visited roots');
+ // The root button names its action and keeps the visible name in it.
+ const name = host.querySelector<HTMLButtonElement>('button.atlas-graph-scope-name')!;
+ expect(name.getAttribute('aria-label')).toBe('Open the source of n2');
+ expect(name.textContent).toBe('n2');
+});
diff --git a/graph-ui/src/galaxy/GalaxyPanel.tsx b/graph-ui/src/galaxy/GalaxyPanel.tsx
index 2b05a2250..90ec33e63 100644
--- a/graph-ui/src/galaxy/GalaxyPanel.tsx
+++ b/graph-ui/src/galaxy/GalaxyPanel.tsx
@@ -2007,7 +2007,7 @@ export default function GalaxyPanel(props: GalaxyPanelProps): JSX.Element {
window.addEventListener('keydown', onKey);
return () => window.removeEventListener('keydown', onKey);
}, [props.workspaceExpanded, scope.scope, trailView, escapeTaken, leaveScope]);
- const historyControls = props.workspaceExpanded ? <span className="atlas-graph-history" role="group" aria-label={galaxyHistoryText.recentList}>
+ const historyControls = props.workspaceExpanded ? <span className="atlas-graph-history" role="group" aria-label={galaxyHistoryText.group}>
<button type="button" aria-label={galaxyHistoryText.back} disabled={!historyBack} onClick={() => goHistory(-1)}
title={historyBack ? galaxyHistoryText.backTo(historyEntryLabel(historyBack)) : galaxyHistoryText.noBack}>{galaxyHistoryText.backGlyph}</button>
<button type="button" aria-label={galaxyHistoryText.forward} disabled={!historyForward} onClick={() => goHistory(1)}
@@ -2567,7 +2567,7 @@ export default function GalaxyPanel(props: GalaxyPanelProps): JSX.Element {
* die Tastatur weiter im Menue "⋯".
*/}
{props.workspaceExpanded && openRoot
- ? <button type="button" className="atlas-graph-scope-name" onClick={openRoot}
+ ? <button type="button" className="atlas-graph-scope-name" onClick={openRoot} aria-label={galaxyToolbarText.openRootLabel(scope.scope.name)}
title={galaxyToolbarText.openRootTitle(scope.scope.name, scopedRoot?.file_path ?? '', scopedRoot?.start_line)}>{scope.scope.name}</button>
: <strong className="atlas-graph-scope-name" title={scope.scope.name}>{scope.scope.name}</strong>}
{props.workspaceExpanded && <select aria-label="Trace direction" title={galaxyToolbarText.traceTitle} value={scope.direction}
diff --git a/graph-ui/src/galaxy/galaxy-strings.ts b/graph-ui/src/galaxy/galaxy-strings.ts
index 0c4093cef..920463172 100644
--- a/graph-ui/src/galaxy/galaxy-strings.ts
+++ b/graph-ui/src/galaxy/galaxy-strings.ts
@@ -48,6 +48,8 @@ export const galaxyHistoryText = {
recentGlyph: '▾',
recentTitle: 'Jump straight to a recently visited root with its last depth, direction and edge types',
recentList: 'Recently visited roots',
+ /** The accessible name of the Back, Forward and Recent group. */
+ group: 'History',
allGraph: 'All graph',
layers: (depth: number) => (depth === 1 ? '1 layer' : `${depth} layers`),
direction: { inbound: 'incoming', outbound: 'outgoing' } as Record<'inbound' | 'outbound', string>,
@@ -106,6 +108,8 @@ export const galaxyToolbarText = {
moreTitle: 'More: open the source, rendered node and edge limits, connection groups',
openSource: 'Open source',
openRootTitle: (name: string, path: string, line?: number) => `Open the source of ${name} in Explore: ${path}${line ? `:${line}` : ''}`,
+ /** The root button's accessible name: its action, with the visible name in it. */
+ openRootLabel: (name: string) => `Open the source of ${name}`,
traceTitle: 'Trace direction: incoming, outgoing or both',
outsideLimits: (nodes: number, edges: number) => `${nodes.toLocaleString()} nodes · ${edges.toLocaleString()} edges outside render limits`,
};