Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

feat(tabbar): keep the options button on every tab

Bas Milius0dbb266c9b45
diff --git a/src/renderer/components/TabBar.test.tsx b/src/renderer/components/TabBar.test.tsx
index b784c7522..917dccc71 100644
--- a/src/renderer/components/TabBar.test.tsx
+++ b/src/renderer/components/TabBar.test.tsx
@@ -264,3 +264,57 @@ describe('TabBar drag-reorder', () => {
expect(onReorder).toHaveBeenCalledWith('p1', null)
})
})
+
+describe('TabBar options button', () => {
+ let root: Root
+ let host: HTMLElement
+
+ beforeEach(async () => {
+ ;(globalThis as { ResizeObserver?: unknown }).ResizeObserver = NoopResizeObserver
+ Element.prototype.scrollIntoView = (): void => {}
+ ;(window as unknown as { nodeTerminal: any }).nodeTerminal = {}
+ host = document.createElement('div')
+ document.body.appendChild(host)
+ useProjects.setState({
+ projects: [project(), project({ id: 'p2', name: 'Beta' })],
+ activeProjectId: 'p1'
+ })
+ root = createRoot(host)
+ await act(async () => {
+ root.render(
+ <TabBar
+ onSwitch={vi.fn()}
+ onReconnect={vi.fn()}
+ onReorder={vi.fn()}
+ onOpenWelcome={vi.fn()}
+ onRename={vi.fn()}
+ onSetFolder={vi.fn()}
+ onCloseProject={vi.fn()}
+ onRemoteAccess={vi.fn()}
+ onSetDefaultAccount={vi.fn()}
+ onSetDefaultPermissionMode={vi.fn()}
+ onOpenProjectSettings={vi.fn()}
+ />
+ )
+ })
+ })
+
+ afterEach(() => {
+ act(() => root.unmount())
+ host.remove()
+ useProjects.setState({ projects: [], activeProjectId: '' })
+ })
+
+ it('sits on every tab, so the menu is reachable without activating it first', () => {
+ expect(host.querySelectorAll('.tab__caret').length).toBe(2)
+ })
+
+ it('opens the menu for the tab it belongs to, active or not', async () => {
+ const inactive = host.querySelectorAll<HTMLButtonElement>('.tab__caret')[1]
+ await act(async () => {
+ inactive.dispatchEvent(new MouseEvent('click', { bubbles: true }))
+ })
+
+ expect(document.querySelector('.tab-menu')).not.toBeNull()
+ })
+})
diff --git a/src/renderer/components/TabBar.tsx b/src/renderer/components/TabBar.tsx
index f3538b900..82560a7c5 100644
--- a/src/renderer/components/TabBar.tsx
+++ b/src/renderer/components/TabBar.tsx
@@ -12,7 +12,7 @@ import { sessionCount, sessionForProject, useProjectSession } from '../session/s
import { tabClickAction } from '../session/relay-tab'
import { useMenuFlip } from '../ui/useMenuFlip'
import { commandTooltip } from '../lib/keybindingOverrides'
-import { IconCanvasView, IconChevronDown, IconKanban, IconPlus } from './icons'
+import { IconCanvasView, IconKanban, IconMoreVertical, IconPlus } from './icons'
import { ProjectGlyph } from './ProjectGlyph'
import {
ALL_PERMISSION_MODES,
@@ -400,17 +400,18 @@ export function TabBar({
{kanbanActive ? <IconCanvasView /> : <IconKanban />}
</button>
)}
- {active && editingId !== p.id && (
+ {editingId !== p.id && (
<button
className="tab__caret"
title="Project options"
+ aria-label="Project options"
onClick={(e) => {
e.stopPropagation()
if (menuId === p.id) closeMenu()
else openMenu(p.id, e.currentTarget)
}}
>
- <IconChevronDown />
+ <IconMoreVertical />
</button>
)}
</div>
diff --git a/src/renderer/components/icons.tsx b/src/renderer/components/icons.tsx
index 955386cdd..5be179e3f 100644
--- a/src/renderer/components/icons.tsx
+++ b/src/renderer/components/icons.tsx
@@ -416,6 +416,16 @@ export const IconMore = () => (
</svg>
)
+/** Vertical ellipsis: the per-row overflow menu, where a horizontal one would read as a separator
+ * between the label beside it and what follows. */
+export const IconMoreVertical = () => (
+ <svg {...S} fill="currentColor" stroke="none">
+ <circle cx="12" cy="5.5" r="1.6" />
+ <circle cx="12" cy="12" r="1.6" />
+ <circle cx="12" cy="18.5" r="1.6" />
+ </svg>
+)
+
/** Bare checkmark. IconCircleCheck is the badged variant and means something else: a completed
* thing, not a selected one. */
export const IconCheck = () => (
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index a4c757dda..b50f398e4 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -453,7 +453,9 @@ body,
line-height: 1;
padding: 2px 2px;
border-radius: 4px;
- opacity: 0;
+ /* Reachable on every tab, not only the active one, so it is never hidden: an affordance that
+ appears on hover cannot be found by someone who does not already know it is there. */
+ opacity: 0.45;
}
.tab:hover .tab__caret {