The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(desktop): right-click zone menu on the pane body
Brooklyn Nicholsonad2d4822e18a
diff --git a/apps/desktop/src/components/pane-shell/tree/renderer/pane-body.tsx b/apps/desktop/src/components/pane-shell/tree/renderer/pane-body.tsxindex 5be46a7b215..91a606eac66 100644--- a/apps/desktop/src/components/pane-shell/tree/renderer/pane-body.tsx+++ b/apps/desktop/src/components/pane-shell/tree/renderer/pane-body.tsx@@ -3,6 +3,10 @@ import { type ReactNode, useCallback, useRef, useState } from 'react'import { useResizeObserver } from '@/hooks/use-resize-observer'interface PaneBodyProps {+ /** Wraps the body's own element (the zone's right-click menu) WITHOUT an+ * extra layout box: the wrapper receives the div itself, so asChild-style+ * triggers attach to it directly. */+ wrap?: (body: ReactNode) => ReactNodehidden: booleanchildren: ReactNode}@@ -10,7 +14,7 @@ interface PaneBodyProps {/** Collapse the zone, not its guests. Retaining the last visible viewport lets* background browser input use the same page coordinates while the restore* rail occupies only a sliver of the layout. Never detach/reparent a webview. */-export function PaneBody({ hidden, children }: PaneBodyProps) {+export function PaneBody({ wrap, hidden, children }: PaneBodyProps) {const ref = useRef<HTMLDivElement>(null)const [size, setSize] = useState<{ width: number; height: number }>()@@ -33,7 +37,7 @@ export function PaneBody({ hidden, children }: PaneBodyProps) {useResizeObserver(remember, ref)- return (+ const body = (<divclassName="relative min-h-0 min-w-0 flex-1 overflow-hidden"ref={ref}@@ -42,4 +46,8 @@ export function PaneBody({ hidden, children }: PaneBodyProps) {{children}</div>)++ // The wrap must not add a layout box: `relative min-h-0 flex-1` rides the+ // body itself so the zone's flex column geometry is unchanged.+ return wrap ? wrap(body) : body}diff --git a/apps/desktop/src/components/pane-shell/tree/renderer/tree-group.test.tsx b/apps/desktop/src/components/pane-shell/tree/renderer/tree-group.test.tsxindex d36ab6d6bc5..08de26aeb3a 100644--- a/apps/desktop/src/components/pane-shell/tree/renderer/tree-group.test.tsx+++ b/apps/desktop/src/components/pane-shell/tree/renderer/tree-group.test.tsx@@ -1,10 +1,11 @@+import { fireEvent, screen } from '@testing-library/react'import { act, type ReactNode } from 'react'import { createRoot, type Root } from 'react-dom/client'import { afterEach, describe, expect, it, vi } from 'vitest'import { registry } from '@/contrib/registry'import { $tabStripDefault, setTabStripDefault } from '@/store/tabstrip-prefs'-import { stubResizeObserver } from '@/test/jsdom'+import { stubMenuDomApis, stubResizeObserver } from '@/test/jsdom'import type { GroupNode } from '../model'import { $treeDragging, NEW_SESSION_DRAG, SESSION_TILE_DRAG } from '../store'@@ -326,4 +327,35 @@ describe('TreeGroup', () => {})})})++ // #92500: a zone with no visible header (strip hidden) strands its pane with+ // no Close anywhere on screen. The BODY must serve the same right-click zone+ // menu the strip carries, so Close/Minimize stay reachable from the pane's+ // own content.+ it('opens the zone menu from ordinary pane body content', () => {+ disposePane = registry.register({+ area: 'panes',+ data: { height: '12rem' },+ id: 'terminal',+ render: () => <div>Terminal</div>,+ title: 'Terminal'+ })+ vi.stubGlobal('CSS', { escape: (value: string) => value })+ stubMenuDomApis()++ render(<TreeGroup node={terminalGroup(false)} parentAxis="column" />)++ const body = globalThis.document.querySelector(`[data-zone-body="terminal-zone"] .relative.min-h-0`)++ expect(body).not.toBeNull()++ // Radix opens the ContextMenu from the contextmenu event; the pointerdown+ // that precedes a real right-click only matters for touch/pen long-press.+ fireEvent.contextMenu(body!, { button: 2 })++ // The zone's own Close (plus the terminal pane's domain menu may carry its+ // own close-flavored row) — what matters is that the BODY opens A menu+ // offering a Close verb.+ expect(screen.getAllByRole('menuitem', { name: /close/i }).length).toBeGreaterThan(0)+ })})diff --git a/apps/desktop/src/components/pane-shell/tree/renderer/tree-group.tsx b/apps/desktop/src/components/pane-shell/tree/renderer/tree-group.tsxindex 8738bbe5543..8d42c903c66 100644--- a/apps/desktop/src/components/pane-shell/tree/renderer/tree-group.tsx+++ b/apps/desktop/src/components/pane-shell/tree/renderer/tree-group.tsx@@ -774,9 +774,29 @@ export function TreeGroup({`visibility` (not display) keeps the hidden pane's layout box, soscroll positions and measurements survive the round-trip — which alsomakes a hidden layer's rect identical to the visible one's, hence the- marker document-wide lookups filter on (see pane-visibility.ts). */}+ marker document-wide lookups filter on (see pane-visibility.ts).+ The body carries the zone's right-click menu too: a pane without a+ header (no strip showing) otherwise has no Close anywhere on screen+ (#92500) — same ZoneMenu the strip and the edit veil already serve. */}{(!node.minimized || mountedPanes.length > 0 || hostedPanes.length > 0) && (- <PaneBody hidden={Boolean(node.minimized)}>+ <PaneBody+ hidden={Boolean(node.minimized)}+ wrap={+ !isEmpty+ ? body => (+ <ZoneMenu {...zoneMenu}>+ <div+ aria-label={t.zones.zoneMenuLabel(String(tabLabel(activeId)))}+ data-zone-body={node.id}+ style={{ display: 'contents' }}+ >+ {body}+ </div>+ </ZoneMenu>+ )+ : undefined+ }+ >{hostedPanes.map(paneId => (<KeepAlivePaneSlotgroupId={node.id}diff --git a/apps/desktop/src/i18n/ar.ts b/apps/desktop/src/i18n/ar.tsindex 0ddc2862f2c..35e94cd03c5 100644--- a/apps/desktop/src/i18n/ar.ts+++ b/apps/desktop/src/i18n/ar.ts@@ -3180,6 +3180,7 @@ export const ar = defineLocale({hideTabStrip: 'إخفاء علامات التبويب',showStripTab: title => `إظهار ${title}`,hideStripTab: title => `إخفاء ${title}`,+ zoneMenuLabel: title => `خيارات المنطقة لـ ${title}`,lastTabKeptTitle: 'يبقى آخر تبويب',lastTabKeptBody:'تحتاج هذه المنطقة إلى تبويب مرئي واحد على الأقل. أظهر تبويبا آخر أولا، أو اطو الشريط الجانبي بأكمله.',diff --git a/apps/desktop/src/i18n/de.ts b/apps/desktop/src/i18n/de.tsindex 4204d41ea9f..e7c3a0f1231 100644--- a/apps/desktop/src/i18n/de.ts+++ b/apps/desktop/src/i18n/de.ts@@ -5365,6 +5365,7 @@ export const deOverrides = {hideTabStrip: 'Tabs ausblenden',showStripTab: title => `${title} anzeigen`,hideStripTab: title => `${title} ausblenden`,+ zoneMenuLabel: title => `Zonenoptionen für ${title}`,lastTabKeptTitle: 'Letzter Tab bleibt',lastTabKeptBody:'Diese Zone braucht mindestens einen sichtbaren Tab. Zeigen Sie zuerst einen anderen Tab an oder klappen Sie die ganze Seitenleiste ein.',diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex 9c1a968d006..b82435bd4ff 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -4971,6 +4971,7 @@ export const en: Translations = {hideTabStrip: 'Hide tabs',showStripTab: title => `Show ${title}`,hideStripTab: title => `Hide ${title}`,+ zoneMenuLabel: title => `Zone options for ${title}`,lastTabKeptTitle: 'Last tab stays',lastTabKeptBody: 'This zone needs at least one visible tab. Show another tab first, or collapse the whole sidebar.',toggleStripTab: title => `Toggle ${title} tab`,diff --git a/apps/desktop/src/i18n/es.ts b/apps/desktop/src/i18n/es.tsindex fc2e2dbbde9..673e6343bf5 100644--- a/apps/desktop/src/i18n/es.ts+++ b/apps/desktop/src/i18n/es.ts@@ -5360,6 +5360,7 @@ export const esOverrides = {hideTabStrip: 'Ocultar pestañas',showStripTab: title => `Mostrar ${title}`,hideStripTab: title => `Ocultar ${title}`,+ zoneMenuLabel: title => `Opciones de zona para ${title}`,lastTabKeptTitle: 'La última pestaña permanece',lastTabKeptBody:'Esta zona necesita al menos una pestaña visible. Muestra otra pestaña primero, o colapsa toda la barra lateral.',diff --git a/apps/desktop/src/i18n/fr.ts b/apps/desktop/src/i18n/fr.tsindex 36e20aa8166..0f4413fc9cb 100644--- a/apps/desktop/src/i18n/fr.ts+++ b/apps/desktop/src/i18n/fr.ts@@ -5381,6 +5381,7 @@ export const frOverrides = {hideTabStrip: 'Masquer les onglets',showStripTab: title => `Afficher ${title}`,hideStripTab: title => `Masquer ${title}`,+ zoneMenuLabel: title => `Options de zone pour ${title}`,lastTabKeptTitle: 'Le dernier onglet reste affiché',lastTabKeptBody:"Cette zone doit conserver au moins un onglet visible. Affichez d'abord un autre onglet ou repliez toute la barre latérale.",diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.tsindex 21bee5c2913..3de6c352377 100644--- a/apps/desktop/src/i18n/ru.ts+++ b/apps/desktop/src/i18n/ru.ts@@ -3914,6 +3914,7 @@ export const ru = defineLocale({hideTabStrip: 'Скрыть вкладки',showStripTab: title => `Показать ${title}`,hideStripTab: title => `Скрыть ${title}`,+ zoneMenuLabel: title => `Параметры зоны для ${title}`,lastTabKeptTitle: 'Последняя вкладка остаётся',lastTabKeptBody:'В этой зоне нужна хотя бы одна видимая вкладка. Сначала покажите другую вкладку или сверните всю боковую панель.',diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.tsindex 342be3597f0..dce1c04d1aa 100644--- a/apps/desktop/src/i18n/types.ts+++ b/apps/desktop/src/i18n/types.ts@@ -4207,6 +4207,7 @@ export interface Translations {hideTabStrip: stringshowStripTab: (title: string) => stringhideStripTab: (title: string) => string+ zoneMenuLabel: (title: string) => stringlastTabKeptTitle: stringlastTabKeptBody: stringtoggleStripTab: (title: string) => stringdiff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.tsindex 1e3eeb15f00..e5b2cce8352 100644--- a/apps/desktop/src/i18n/zh.ts+++ b/apps/desktop/src/i18n/zh.ts@@ -4668,6 +4668,7 @@ export const zh = defineLocale({hideTabStrip: '隐藏标签',showStripTab: title => `显示 ${title}`,hideStripTab: title => `隐藏 ${title}`,+ zoneMenuLabel: title => `${title} 的区域选项`,lastTabKeptTitle: '保留最后一个标签',lastTabKeptBody: '该区域至少需要一个可见标签。请先显示另一个标签,或折叠整个侧边栏。',toggleStripTab: title => `切换 ${title} 标签`,