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.
C aiderastclaude-codecode-analysiscode-intelligencecodexcursorcypherdeveloper-toolsgemini-cligraph-visualizationkilocodeknowledge-graphmcpmcp-servermodel-context-protocolopencodesqlitetree-sitterwindsurf
fix(ui): put Architecture Back and Forward first, as in Galaxy, and close Recent menus (A1, A2)
Bernhard Jackiewicz397b5dc68d6c
diff --git a/graph-ui/src/architecture/ArchitecturePanel.history.test.tsx b/graph-ui/src/architecture/ArchitecturePanel.history.test.tsxindex 4791f2c4c..fc9d60dd4 100644--- a/graph-ui/src/architecture/ArchitecturePanel.history.test.tsx+++ b/graph-ui/src/architecture/ArchitecturePanel.history.test.tsx@@ -9,6 +9,7 @@ import { act } from 'react';import { createRoot, type Root } from 'react-dom/client';import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import ArchitecturePanel, { type ArchitecturePanelProps } from './ArchitecturePanel';+import { fitToolbar } from '../galaxy/toolbar-fit';import type { ArchitectureSceneProps } from './ArchitectureScene';import type { ArchitectureOverviewDto } from '../core/intelligence-provider';import type { GraphData, GraphNode } from '../galaxy/types';@@ -126,8 +127,8 @@ const filter = () => container.querySelector<HTMLInputElement>('input[type="searconst focus = () => container.querySelector('[data-testid="system-scene"]')?.getAttribute('data-focus');const heading = () => container.querySelector('.behavior-heading h2')?.textContent;const sceneLabels = () => [...container.querySelectorAll('[data-testid="scene"] [data-node]')].map(item => item.textContent);-/** The "← Back" System structure and Behavior had in their own toolbars before K27. */-const inViewBack = () => buttons().find(button => button.textContent === '← Back');+/** The "← Back" System structure and Behavior had in their own toolbars before K27; the shared one carries the same words. */+const inViewBack = () => buttons().find(button => button.textContent === '← Back' && !history()?.contains(button));const systemCamera = () => container.querySelector('[aria-label="System camera"] button[aria-pressed="true"]')?.textContent;const behaviorCamera = () => container.querySelector('[aria-label="Behavior camera"] button[aria-pressed="true"]')?.textContent;const chainPosition = () => container.querySelector('[aria-label="Walk the call chain"] span')?.textContent;@@ -495,3 +496,61 @@ describe('Architecture back and forward (K27)', () => {expect(container.querySelector('details.atlas-arch-recent')).toBeNull();});});++/*+ * Hand test 2026-10-04: Back, Forward and Recent stood as bare arrows at the right end of the subtab row,+ * while Galaxy has "← Back", "Forward →" and "▾" at the start of its toolbar (A1), and the Recent menu stayed+ * open over the content through several steps (A2).+ */+describe('Architecture history controls as in Galaxy (hand test 2026-10-04)', () => {+ const recentMenu = () => container.querySelector<HTMLDetailsElement>('details.atlas-arch-recent');+ async function withRecent(): Promise<HTMLDetailsElement> {+ await render();+ await press(container.querySelector<HTMLButtonElement>('[data-view="routes"]'));+ await press(container.querySelector<HTMLButtonElement>('[data-view="hotspots"]'));+ const menu = recentMenu();+ expect(menu).not.toBeNull();+ await act(async () => { menu!.open = true; });+ return menu!;+ }++ it('A1: puts Back, Forward and Recent at the start of the subtab row, worded as in Galaxy', async () => {+ await render();+ await press(container.querySelector<HTMLButtonElement>('[data-view="routes"]'));+ const row = container.querySelector<HTMLElement>('.atlas-arch-tabrow')!;+ expect([...row.children].map(item => item.getAttribute('aria-label'))).toEqual(['Architecture history', 'Architecture views']);+ expect(back()?.textContent).toBe('← Back');+ expect(back()?.querySelector('.atlas-fit-narrow')?.getAttribute('data-label')).toBe('←');+ expect(forward()?.textContent).toBe('Forward →');+ expect(forward()?.querySelector('.atlas-fit-narrow')?.getAttribute('data-label')).toBe('→');+ expect(back()?.title).toBe('Back to Overview (Alt+Left)');+ expect(recentMenu()?.querySelector('summary')?.textContent).toBe('▾');+ // The row measures itself like Galaxy's toolbar: words while the tabs fit, the glyphs once they would scroll.+ expect(row.dataset.fit).toBe('full');+ const tabs = row.querySelector<HTMLElement>('nav')!;+ Object.defineProperties(tabs, { clientWidth: { configurable: true, value: 300 }, scrollWidth: { configurable: true, value: 520 } });+ expect(fitToolbar(row)).toBe('compact');+ });++ it('A2: closes the Recent menu on a press elsewhere and on Escape, which stays with the menu', async () => {+ const menu = await withRecent();+ await act(async () => { container.querySelector('.atlas-arch-tabs')!.dispatchEvent(new MouseEvent('pointerdown', { bubbles: true })); });+ expect(menu.open).toBe(false);+ await act(async () => { menu.open = true; });+ expect(key({ key: 'Escape' }, menu.querySelector('summary')!).defaultPrevented).toBe(true);+ expect(menu.open).toBe(false);+ expect(view()).toBe('hotspots');+ });++ it('A2: closes the Recent menu when Back or Alt+Right change the place', async () => {+ const menu = await withRecent();+ await goBack();+ expect(view()).toBe('routes');+ expect(menu.open).toBe(false);+ await act(async () => { menu.open = true; });+ expect(key({ key: 'ArrowRight', altKey: true }).defaultPrevented).toBe(true);+ await settle();+ expect(view()).toBe('hotspots');+ expect(menu.open).toBe(false);+ });+});diff --git a/graph-ui/src/architecture/ArchitecturePanel.tsx b/graph-ui/src/architecture/ArchitecturePanel.tsxindex f91103022..5eb740d3e 100644--- a/graph-ui/src/architecture/ArchitecturePanel.tsx+++ b/graph-ui/src/architecture/ArchitecturePanel.tsx@@ -1,4 +1,4 @@-import { lazy, Suspense, useCallback, useEffect, useMemo, useState } from 'react';+import { lazy, Suspense, useCallback, useEffect, useMemo, useRef, useState } from 'react';import type { JSX, ReactNode } from 'react';import type { ArchitectureHotspot, ArchitectureOverviewDto } from '../core/intelligence-provider';import {@@ -7,6 +7,8 @@ import {import type { ArchitectureView, ConfigStorage } from './architecture-model';import { architectureHistoryText as historyText, architectureText as text } from './strings';import { peekNavigation, type NavigationHistory } from '../graph/navigation-history';+import { useDismissibleMenu } from '../graph/use-dismissible-menu';+import { FitLabel, useToolbarFit } from '../galaxy/toolbar-fit';import {architectureEntryDetail, architectureEntryLabel, architectureEntryName, architectureHistoryOptions, initialArchitecturePlace,type ArchitectureHistoryEntry, type PlaceChange, type RoutesPerspective, type SpatialPlace, type SystemPlace,@@ -125,6 +127,9 @@ const paletteStyle = scenePaletteStyle();* Back, Forward and the Recent list for the whole workspace (K27). The* tooltips name the target ("Back to Overview · django"); the list holds the* last distinct places, newest first, and the current one is not a target.+ * They stand at the start of the subtab row and read as in Galaxy, "← Back",+ * "Forward →" and "▾", with the glyphs alone once the tabs would scroll+ * (hand test 2026-10-04, A1). The menu closes as Galaxy's does (A2).*/function HistoryControls({ history, place, onGo, onJump }: {history: NavigationHistory<ArchitectureHistoryEntry>; place: ArchitectureHistoryEntry;@@ -132,23 +137,23 @@ function HistoryControls({ history, place, onGo, onJump }: {}): JSX.Element {const back = peekNavigation(history, -1), forward = peekNavigation(history, 1);const here = architectureHistoryOptions.recentKey?.(place);+ const menu = useDismissibleMenu(architectureHistoryOptions.key(place));return <div className="atlas-arch-history" role="group" aria-label={historyText.group} data-position={`${history.index + 1}/${history.entries.length}`}><button type="button" aria-label={historyText.back} disabled={!back} onClick={() => onGo(-1)}- title={back ? historyText.backTo(architectureEntryLabel(back)) : historyText.noBack}>{historyText.backGlyph}</button>+ title={back ? historyText.backTo(architectureEntryLabel(back)) : historyText.noBack}>+ <FitLabel wide={historyText.backWide} narrow={historyText.backGlyph} /></button><button type="button" aria-label={historyText.forward} disabled={!forward} onClick={() => onGo(1)}- title={forward ? historyText.forwardTo(architectureEntryLabel(forward)) : historyText.noForward}>{historyText.forwardGlyph}</button>- {history.recent.length > 1 && <details className="atlas-arch-recent" onKeyDown={event => {- if (event.key === 'Escape') { event.stopPropagation(); event.currentTarget.open = false; }- }}>+ title={forward ? historyText.forwardTo(architectureEntryLabel(forward)) : historyText.noForward}>+ <FitLabel wide={historyText.forwardWide} narrow={historyText.forwardGlyph} /></button>+ {history.recent.length > 1 && <details className="atlas-arch-recent" ref={menu.ref}><summary title={historyText.recentTitle} aria-label={historyText.recent}>{historyText.recentGlyph}</summary><ul className="atlas-arch-recent-menu" aria-label={historyText.recentList}>{history.recent.map(entry => {const id = architectureHistoryOptions.recentKey?.(entry);const current = id === here;const detail = architectureEntryDetail(entry);return <li key={id}>- <button type="button" disabled={current} aria-current={current ? 'true' : undefined} title={architectureEntryLabel(entry)} onClick={event => {- const details = event.currentTarget.closest('details');- if (details) details.open = false;+ <button type="button" disabled={current} aria-current={current ? 'true' : undefined} title={architectureEntryLabel(entry)} onClick={() => {+ menu.close();onJump(entry);}}><strong>{architectureEntryName(entry)}</strong>{detail && <span>{detail}</span>}</button></li>;@@ -164,7 +169,7 @@ function ArchitectureWorkspace({ projectName, overview, loading = false, error,* route perspective and filter, System structure focus and groups, Behavior* start, destination and position, and Plan or 3D of each scene. The views* below read their part of it and report changes back, so Back and Forward- * restore every part at once; the one Back for all of them sits beside the+ * restore every part at once; the one Back for all of them sits before the* subtabs. A filter is a search for this visit: one saved by an earlier* session would silently hide routes, so only the subtab is read back.*/@@ -172,6 +177,9 @@ function ArchitectureWorkspace({ projectName, overview, loading = false, error,active, escapeTaken, onRestore: (from, to) => { if (from.view !== to.view) onSelectionEvidence?.(undefined); },});const { place, navigate } = navigation;+ // The row measures itself as Galaxy's toolbar does (toolbar-fit.tsx): it counts as narrow once the tabs would scroll.+ const tabRow = useRef<HTMLDivElement>(null);+ useToolbarFit(tabRow, true);useEffect(() => { saveArchitectureConfig(storage, projectName, { view: place.view, filter: place.filter }); }, [place.view, place.filter, projectName, storage]);const setView = useCallback((view: ArchitectureView) => navigate(current => ({ ...current, view: view === 'dependencies' ? 'overview' : view })), [navigate]);const changeSpatial = useCallback<PlaceChange<SpatialPlace>>((change, automatic) =>@@ -198,11 +206,11 @@ function ArchitectureWorkspace({ projectName, overview, loading = false, error,} : undefined;// Every scene below draws with the same palette; the DOM reads it as CSS variables.return <section className="atlas-architecture" data-testid="atlas-architecture" data-system-view={systemView} aria-label={text.title} aria-busy={!systemView && loading} style={paletteStyle}>- <div className="atlas-arch-tabrow">- <nav className="atlas-arch-tabs" aria-label={text.navigation}>{ARCHITECTURE_VIEWS.map(view =>+ <div className="atlas-arch-tabrow" ref={tabRow}>+ <HistoryControls history={navigation.history} place={place} onGo={navigation.go} onJump={navigation.jump} />+ <nav className="atlas-arch-tabs" aria-label={text.navigation} data-fit-whole="">{ARCHITECTURE_VIEWS.map(view =><button className="atlas-arch-tab" key={view} aria-pressed={place.view === view || (view === 'overview' && ['dependencies', 'entryPoints'].includes(place.view))} data-view={view}onClick={() => { if (view !== place.view) onSelectionEvidence?.(undefined); setView(view); }}>{text.views[view]}</button>)}</nav>- <HistoryControls history={navigation.history} place={place} onGo={navigation.go} onJump={navigation.jump} /></div>{systemView && projectName ? <Suspense fallback={<div role="status"><Empty>Preparing system analysis…</Empty></div>}><SystemArchitectureproject={projectName} generation={graphGeneration} view={systemView} filter={filter} active={active}diff --git a/graph-ui/src/architecture/architecture.css b/graph-ui/src/architecture/architecture.cssindex 064eb889c..66ba9422b 100644--- a/graph-ui/src/architecture/architecture.css+++ b/graph-ui/src/architecture/architecture.css@@ -45,21 +45,30 @@}.atlas-arch-tab[aria-pressed="true"] { color: var(--atlas-fg); border-bottom-color: var(--atlas-phosphor); }.atlas-arch-tab:hover { color: var(--atlas-fg); background: var(--atlas-panel); }-/* K27: the tabs and one Back, Forward and Recent for the whole workspace share a row. The menu sits outside the scrolling tab strip. */-.atlas-arch-tabrow { display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--atlas-line); margin-bottom: 16px; }+/*+ * K27: one Back, Forward and Recent for the whole workspace and the tabs share a row. The menu sits outside the+ * scrolling tab strip. Hand test 2026-10-04 (A1): the controls come first and read as in Galaxy, "← Back" and+ * "Forward →" while the tabs fit, the glyphs alone once they would scroll (`data-fit`, galaxy/toolbar-fit.tsx).+ */+.atlas-arch-tabrow { display: flex; align-items: center; gap: 14px; border-bottom: 1px solid var(--atlas-line); margin-bottom: 16px; }.atlas-arch-tabrow > .atlas-arch-tabs { flex: 1 1 auto; min-width: 0; border-bottom: 0; margin-bottom: 0; }.atlas-arch-history { display: flex; align-items: center; gap: 4px; flex: none; position: relative; }.atlas-arch-history > button, .atlas-arch-recent > summary {- border: 1px solid var(--atlas-line); border-radius: 7px; background: var(--atlas-panel); color: var(--atlas-fg);- min-width: 32px; min-height: 30px; padding: 3px 8px; line-height: 1.4;+ border: 1px solid var(--atlas-line); border-radius: 6px; background: var(--atlas-panel); color: var(--atlas-fg);+ min-width: 30px; min-height: 30px; padding: 3px 10px; line-height: 1.4; white-space: nowrap;}.atlas-arch-history > button:hover:not(:disabled), .atlas-arch-recent > summary:hover { background: var(--atlas-panel-raised); border-color: var(--atlas-dim); }-.atlas-arch-history > button:disabled { opacity: 0.45; }+.atlas-arch-history > button:disabled { opacity: 0.4; }+.atlas-arch-history .atlas-fit-narrow { display: none; }+.atlas-arch-history .atlas-fit-narrow::before { content: attr(data-label); }+.atlas-arch-tabrow:is([data-fit=compact], [data-fit=tight], [data-fit=wrap]) .atlas-arch-history .atlas-fit-wide { display: none; }+.atlas-arch-tabrow:is([data-fit=compact], [data-fit=tight], [data-fit=wrap]) .atlas-arch-history .atlas-fit-narrow { display: inline; }+.atlas-arch-tabrow:is([data-fit=compact], [data-fit=tight], [data-fit=wrap]) .atlas-arch-history > button { padding-inline: 8px; }.atlas-arch-recent { position: relative; }-.atlas-arch-recent > summary { display: block; cursor: pointer; list-style: none; text-align: center; white-space: nowrap; color: var(--atlas-dim); }+.atlas-arch-recent > summary { display: block; cursor: pointer; list-style: none; text-align: center; color: var(--atlas-dim); padding-inline: 8px; }.atlas-arch-recent > summary::-webkit-details-marker { display: none; }.atlas-arch-recent-menu {- position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; width: min(24rem, calc(100vw - 3rem)); max-height: 20rem; overflow: auto;+ position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; width: min(24rem, calc(100vw - 3rem)); max-height: 20rem; overflow: auto;margin: 0; padding: 6px; list-style: none; border: 1px solid var(--atlas-line); border-radius: 8px; background: var(--atlas-panel); box-shadow: 0 8px 24px #0006;}.atlas-arch-recent-menu button {diff --git a/graph-ui/src/architecture/strings.ts b/graph-ui/src/architecture/strings.tsindex 867b173a4..e9b3bf937 100644--- a/graph-ui/src/architecture/strings.ts+++ b/graph-ui/src/architecture/strings.ts@@ -114,6 +114,9 @@ export const architectureHistoryText = {forward: 'Forward',backGlyph: '←',forwardGlyph: '→',+ /** The words while the subtab row has room, as in Galaxy; the glyphs alone once the tabs would scroll. */+ backWide: '← Back',+ forwardWide: 'Forward →',backTo: (label: string) => `Back to ${label} (Alt+Left)`,forwardTo: (label: string) => `Forward to ${label} (Alt+Right)`,noBack: 'Nothing to go back to yet',diff --git a/graph-ui/src/galaxy/GalaxyPanel.history.test.tsx b/graph-ui/src/galaxy/GalaxyPanel.history.test.tsxindex e705d193d..cb2eb57ff 100644--- a/graph-ui/src/galaxy/GalaxyPanel.history.test.tsx+++ b/graph-ui/src/galaxy/GalaxyPanel.history.test.tsx@@ -207,6 +207,27 @@ it('K2: the recent list jumps straight to an earlier root with its last depth',expect(named('Back')?.title).toBe('Back to n5 · 1 layer (Alt+Left)');});+/* Handtest 2026-10-04 (A2): die Liste blieb ueber der Szene offen, Schritt um Schritt. */+it('A2: the recent list closes on a press elsewhere, on Escape without leaving the scope, and when Back changes the root', async () => {+ await openScope();+ await act(async () => { seam().clickNode('sample.n2'); });+ await settle(() => expect(scopeName()).toBe('n2'));+ const recent = host.querySelector<HTMLDetailsElement>('details.atlas-graph-recent')!;+ await act(async () => { recent.open = true; });+ await act(async () => { button('Empty canvas')!.dispatchEvent(new MouseEvent('pointerdown', { bubbles: true })); });+ expect(recent.open).toBe(false);++ await act(async () => { recent.open = true; });+ expect(key({ key: 'Escape' }, recent.querySelector('summary')!).defaultPrevented).toBe(true);+ expect(recent.open).toBe(false);+ expect(scopeName()).toBe('n2');++ await act(async () => { recent.open = true; });+ await act(async () => named('Back')!.click());+ await settle(() => expect(scopeName()).toBe('n1'));+ expect(recent.open).toBe(false);+});+/** Wie App.tsx: die Auswahl lebt ausserhalb des Panels, "Selection details"* steht nur, solange sie besteht, und `onClearSelection` loescht sie.diff --git a/graph-ui/src/galaxy/GalaxyPanel.tsx b/graph-ui/src/galaxy/GalaxyPanel.tsxindex be266df88..960f16a83 100644--- a/graph-ui/src/galaxy/GalaxyPanel.tsx+++ b/graph-ui/src/galaxy/GalaxyPanel.tsx@@ -143,6 +143,7 @@ import { galaxyHierarchyText, galaxyHistoryText, galaxyLayerText, galaxyPathTextimport { HierarchyBandLabel, HierarchyEdgeLabels } from './HierarchyEdgeLabels';import { FitLabel, useToolbarFit } from './toolbar-fit';import { emptyNavigationHistory, moveNavigation, peekNavigation, pushNavigation } from '../graph/navigation-history';+import { useDismissibleMenu } from '../graph/use-dismissible-menu';import { galaxyHistoryOptions, historyEntryDetail, historyEntryLabel, scopeIdentity, type GalaxyHistoryEntry, type ScopeTrail } from './scope-history';import { useOrganicLayout } from './use-organic-layout';import RenderProgress from './RenderProgress';@@ -2033,6 +2034,8 @@ export default function GalaxyPanel(props: GalaxyPanelProps): JSX.Element {window.addEventListener('keydown', onKey);return () => window.removeEventListener('keydown', onKey);}, [props.workspaceExpanded, scope.scope, trailView, escapeTaken, leaveScope]);+ /* Handtest 2026-10-04 (A2): die Liste schliesst bei einem Klick daneben, mit Escape und mit jedem neuen Ort. */+ const recentMenu = useDismissibleMenu(historyKey);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}>@@ -2040,16 +2043,13 @@ export default function GalaxyPanel(props: GalaxyPanelProps): JSX.Element {<button type="button" aria-label={galaxyHistoryText.forward} disabled={!historyForward} onClick={() => goHistory(1)}title={historyForward ? galaxyHistoryText.forwardTo(historyEntryLabel(historyForward)) : galaxyHistoryText.noForward}><FitLabel wide={galaxyHistoryText.forwardWide} narrow={galaxyHistoryText.forwardGlyph} /></button>- {history.recent.length > 1 && <details className="atlas-graph-recent" onKeyDown={event => {- if (event.key === 'Escape') { event.stopPropagation(); event.currentTarget.open = false; }- }}>+ {history.recent.length > 1 && <details className="atlas-graph-recent" ref={recentMenu.ref}><summary title={galaxyHistoryText.recentTitle} aria-label={galaxyHistoryText.recent}>{galaxyHistoryText.recentGlyph}</summary><ul className="atlas-graph-recent-menu" aria-label={galaxyHistoryText.recentList}>{history.recent.map((entry) => {const current = galaxyHistoryOptions.recentKey?.(entry) === (scope.scope ? scopeIdentity(scope.scope) : undefined);return <li key={galaxyHistoryOptions.recentKey?.(entry)}>- <button type="button" disabled={current} aria-current={current ? 'true' : undefined} onClick={(event) => {- const details = event.currentTarget.closest('details');- if (details) details.open = false;+ <button type="button" disabled={current} aria-current={current ? 'true' : undefined} onClick={() => {+ recentMenu.close();jumpToRecent(entry);}}><strong>{entry.scope?.name}</strong><span>{historyEntryDetail(entry)}</span></button></li>;diff --git a/graph-ui/src/graph/use-dismissible-menu.test.tsx b/graph-ui/src/graph/use-dismissible-menu.test.tsxnew file mode 100644index 000000000..f898b45eb--- /dev/null+++ b/graph-ui/src/graph/use-dismissible-menu.test.tsx@@ -0,0 +1,86 @@+// @vitest-environment jsdom+import { act } from 'react';+import { createRoot, type Root } from 'react-dom/client';+import { afterEach, beforeEach, expect, it, vi } from 'vitest';+import { useDismissibleMenu } from './use-dismissible-menu';++/*+ * Hand test 2026-10-04 (A2): the Recent menus of Galaxy and Architecture stayed open over the content+ * through several steps and while scrolling. Both use this hook.+ */+let host: HTMLDivElement, root: Root;+beforeEach(() => {+ (globalThis as unknown as Record<string, unknown>).IS_REACT_ACT_ENVIRONMENT = true;+ host = document.createElement('div'); document.body.append(host); root = createRoot(host);+});+afterEach(async () => { await act(async () => root.unmount()); host.remove(); });++function Fixture({ place, onPick }: { place: string; onPick: () => void }) {+ const menu = useDismissibleMenu(place);+ return <div>+ <details ref={menu.ref}><summary>Recent</summary>+ <ul><li><button type="button" onClick={() => { menu.close(); onPick(); }}>Overview</button></li></ul></details>+ <p>Content</p><input aria-label="Elsewhere" />+ </div>;+}+async function setup(place = 'a') {+ const pick = vi.fn();+ await act(async () => root.render(<Fixture place={place} onPick={pick} />));+ const details = host.querySelector('details')!;+ await act(async () => { details.open = true; });+ return { pick, details };+}+const fire = (target: EventTarget, type: string) => act(async () => { target.dispatchEvent(new MouseEvent(type, { bubbles: true, cancelable: true })); });++it('closes on a pointer press outside the menu and stays open for one inside it', async () => {+ const { details } = await setup();+ await fire(details.querySelector('summary')!, 'pointerdown');+ await fire(details.querySelector('li button')!, 'pointerdown');+ expect(details.open).toBe(true);+ await fire(host.querySelector('p')!, 'pointerdown');+ expect(details.open).toBe(false);+});++it('closes when the page scrolls under it or focus moves elsewhere', async () => {+ const { details } = await setup();+ await act(async () => { host.querySelector('p')!.dispatchEvent(new WheelEvent('wheel', { bubbles: true, deltaY: 120 })); });+ expect(details.open).toBe(false);+ await act(async () => { details.open = true; });+ // The list scrolls itself without closing.+ await act(async () => { details.querySelector('ul')!.dispatchEvent(new WheelEvent('wheel', { bubbles: true, deltaY: 120 })); });+ expect(details.open).toBe(true);+ await act(async () => { host.querySelector('input')!.focus(); });+ expect(details.open).toBe(false);+});++it('closes on Escape, takes the key from the page and returns focus to its summary', async () => {+ const { details } = await setup();+ const entry = details.querySelector<HTMLButtonElement>('li button')!;+ entry.focus();+ const event = new KeyboardEvent('keydown', { key: 'Escape', bubbles: true, cancelable: true });+ const page = vi.fn();+ window.addEventListener('keydown', page);+ await act(async () => { entry.dispatchEvent(event); });+ window.removeEventListener('keydown', page);+ expect(details.open).toBe(false);+ expect(event.defaultPrevented).toBe(true);+ expect(page).not.toHaveBeenCalled();+ expect(document.activeElement).toBe(details.querySelector('summary'));+ // Closed, Escape belongs to the page again.+ const later = new KeyboardEvent('keydown', { key: 'Escape', bubbles: true, cancelable: true });+ await act(async () => { document.body.dispatchEvent(later); });+ expect(later.defaultPrevented).toBe(false);+});++it('closes when an entry is chosen and whenever the place changes', async () => {+ const { pick, details } = await setup();+ await act(async () => details.querySelector<HTMLButtonElement>('li button')!.click());+ expect(pick).toHaveBeenCalledOnce();+ expect(details.open).toBe(false);+ await act(async () => { details.open = true; });+ await act(async () => root.render(<Fixture place="a" onPick={pick} />));+ expect(details.open).toBe(true);+ // Back, Forward, Alt+Left or any other step leads to another place.+ await act(async () => root.render(<Fixture place="b" onPick={pick} />));+ expect(details.open).toBe(false);+});diff --git a/graph-ui/src/graph/use-dismissible-menu.ts b/graph-ui/src/graph/use-dismissible-menu.tsnew file mode 100644index 000000000..6c0b961c1--- /dev/null+++ b/graph-ui/src/graph/use-dismissible-menu.ts@@ -0,0 +1,57 @@+import { useCallback, useEffect, useRef } from 'react';++/**+ * A `<details>` menu that closes once the reader is done with it, as the+ * Recent menus of Galaxy and Architecture do (hand test 2026-10-04, A2: the+ * menu stayed open over the content through several steps and while+ * scrolling).+ *+ * It closes on a pointer press, a wheel turn or a focus outside it, on Escape+ * (which then belongs to the menu alone: the page neither leaves its scope nor+ * clears its selection), when the caller closes it after an entry was chosen,+ * and whenever `place` changes: Back, Forward, Alt+Left and every other step+ * lead somewhere else, and the list would name the wrong current place.+ *+ * The listeners stay on the document for the life of the menu and do nothing+ * while it is closed, so opening it needs no React state and no render.+ */+export function useDismissibleMenu(place: string) {+ const ref = useRef<HTMLDetailsElement>(null);+ const close = useCallback(() => {+ const menu = ref.current;+ if (menu?.open) menu.open = false;+ }, []);+ useEffect(() => {+ const outside = (event: Event) => {+ const menu = ref.current;+ if (menu?.open && !(event.target instanceof Node && menu.contains(event.target))) menu.open = false;+ };+ const escape = (event: KeyboardEvent) => {+ const menu = ref.current;+ if (event.key !== 'Escape' || !menu?.open) return;+ event.preventDefault();+ event.stopPropagation();+ const inside = document.activeElement instanceof Node && menu.contains(document.activeElement);+ menu.open = false;+ // An entry that had focus is hidden now; the summary keeps the reader in place.+ if (inside) menu.querySelector('summary')?.focus();+ };+ document.addEventListener('pointerdown', outside, true);+ document.addEventListener('wheel', outside, { capture: true, passive: true });+ document.addEventListener('focusin', outside, true);+ document.addEventListener('keydown', escape, true);+ return () => {+ document.removeEventListener('pointerdown', outside, true);+ document.removeEventListener('wheel', outside, { capture: true });+ document.removeEventListener('focusin', outside, true);+ document.removeEventListener('keydown', escape, true);+ };+ }, []);+ const shown = useRef(place);+ useEffect(() => {+ if (shown.current === place) return;+ shown.current = place;+ close();+ }, [place, close]);+ return { ref, close };+}diff --git a/graph-ui/tools/handtest-fixes-k27.mjs b/graph-ui/tools/handtest-fixes-k27.mjsindex bb82db99b..e6bb7d046 100644--- a/graph-ui/tools/handtest-fixes-k27.mjs+++ b/graph-ui/tools/handtest-fixes-k27.mjs@@ -100,8 +100,11 @@ async function state(page) {behaviorCamera: text(root.querySelector('[aria-label="Behavior camera"] button[aria-pressed="true"]')),chain: text(root.querySelector('[aria-label="Walk the call chain"] span')),path: paths.length ? paths.findIndex((element) => element.getAttribute('aria-pressed') === 'true') + 1 : null,- /* Das "← Back", das System structure und Behavior frueher in der eigenen Leiste hatten. */- inViewBack: [...root.querySelectorAll('button')].filter((element) => element.textContent?.trim() === '← Back').length,+ /*+ * Das "← Back", das System structure und Behavior frueher in der eigenen Leiste hatten. Das gemeinsame+ * Zurueck traegt seit dem Handtest vom 2026-10-04 (A1) dieselben Worte wie in Galaxy und zaehlt nicht mit.+ */+ inViewBack: [...root.querySelectorAll('button')].filter((element) => element.textContent?.trim() === '← Back' && !history?.contains(element)).length,back: button('Back'), forward: button('Forward'),position: history?.getAttribute('data-position') ?? null,recent: [...(history?.querySelectorAll('[aria-label="Recently visited places"] li button') ?? [])].map((element) => ({