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.

fix(tabbar): keep scrolled tabs out of the window drag region

review28ebf0b56fe2
diff --git a/CLAUDE.md b/CLAUDE.md
index 148e8508b..1c47abc36 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -4280,6 +4280,13 @@ the Settings section and ShortcutsPanel start disagreeing about what a chord mea
XWayland and quietly ignored otherwise. Size and maximized restore either way, which is what the
drop-don't-clamp rule already degrades to.
- **Window chrome**: macOS integrated title bar (`titleBarStyle: 'hiddenInset'`); the tab
+ strip's stationary viewport is the only `no-drag` region for its contents. Explicit regions on
+ scrolled descendants escape the overflow clip in Electron's native hit test and subtract from
+ the wordmark after scrolling (#847). Keep tab/button/input descendants at the initial `none`;
+ the viewport already excludes dragging over them. `scripts/tabbar-drag.test.ts` uses real
+ Electron and native XTest input on a disposable Xvfb display (CDP input bypasses this hit test).
+ It checks 41 tabs at start/partial/middle/end/back, 28/40/64px heights and both padding modes;
+ it does not verify macOS traffic lights, Windows, or movement under a real window manager. The
bar (`TabBar.tsx`) is the drag region with the `nodeterm` logo + a **Chrome-style tab strip**
(2026-09-16): inactive tabs are flat and separated by a 1px divider that drops on both sides of a
hovered or active tab, hover is an inset pill, and the active tab is `--canvas-bg` with rounded
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 2fc26fff9..9a4dcec40 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -663,6 +663,11 @@ proof of foreground clipboard-image support. Keep shell/SSH/Server file routing
suppression of accompanying text; do not synthesize Ctrl+V or try both routes without a
capability and receipt protocol. The shortcuts panel documents this distinction (#712).
+The titlebar's scroll viewport owns its `no-drag` region. Do not add `app-region: no-drag`
+to tabs or their descendants: Electron can subtract their off-screen rectangles from the
+wordmark's drag area. `scripts/tabbar-drag.test.ts` checks native hit testing with isolated
+Electron/Xvfb on Linux; macOS traffic lights and actual window movement still need device checks.
+
`npm test` must pass, and `npm run typecheck` is the fastest gate.
Beyond that, one habit is worth more than any other here:
diff --git a/scripts/tabbar-drag.electron.cjs b/scripts/tabbar-drag.electron.cjs
new file mode 100644
index 000000000..2af076ad9
--- /dev/null
+++ b/scripts/tabbar-drag.electron.cjs
@@ -0,0 +1,80 @@
+// Launched only by tabbar-drag.test.ts, on its own Xvfb display and disposable profile.
+// Native XTest clicks matter: CDP / sendInputEvent bypass Electron's window hit test.
+const { app, BrowserWindow } = require('electron')
+const { readFileSync } = require('node:fs')
+const { execFileSync } = require('node:child_process')
+const assert = require('node:assert/strict')
+
+const [profile, stylesheet] = process.argv.slice(-2)
+app.setPath('userData', profile)
+app.commandLine.appendSwitch('disable-gpu')
+const pause = () => new Promise(resolve => setTimeout(resolve, 60))
+const nativeClick = (x, y) => execFileSync('python3', ['-c', `
+import ctypes
+x = ctypes.CDLL('libX11.so.6'); t = ctypes.CDLL('libXtst.so.6')
+x.XOpenDisplay.restype = ctypes.c_void_p
+d = x.XOpenDisplay(None)
+assert d, 'Xvfb display unavailable'
+t.XTestFakeMotionEvent.argtypes = [ctypes.c_void_p, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_ulong]
+t.XTestFakeButtonEvent.argtypes = [ctypes.c_void_p, ctypes.c_uint, ctypes.c_int, ctypes.c_ulong]
+x.XSync.argtypes = [ctypes.c_void_p, ctypes.c_int]
+x.XCloseDisplay.argtypes = [ctypes.c_void_p]
+t.XTestFakeMotionEvent(d, -1, ${x}, ${y}, 0)
+t.XTestFakeButtonEvent(d, 1, 1, 0)
+t.XTestFakeButtonEvent(d, 1, 0, 0)
+x.XSync(d, 0)
+x.XCloseDisplay(d)
+`])
+
+app.whenReady().then(async () => {
+ const win = new BrowserWindow({ width: 1000, height: 600, frame: false,
+ webPreferences: { sandbox: true, contextIsolation: true, nodeIntegration: false, spellcheck: false } })
+ const js = code => win.webContents.executeJavaScript(code)
+ // Isolated titlebar fixture using the full production stylesheet. No bridge, PTY or user data.
+ const tabs = Array.from({ length: 41 }, (_,i) => `<div class="tab${i === 0 ? ' active' : ''}" draggable="true"><span class="tab__name">Project ${i}</span><input class="tab__edit" value="Rename ${i}" style="width:60px"><button class="tab__caret">⋮</button></div>`).join('')
+ await win.loadURL('data:text/html,' + encodeURIComponent(`<style>${readFileSync(stylesheet, 'utf8')}</style><div class="tabbar"><div class="brand"><span class="brand__name">nodeterm</span></div><div class="tabbar__projects"><div class="tabbar__tabs">${tabs}</div><button class="tab-add">+</button></div></div>`))
+ await js(`window.hits=[]; document.addEventListener('mousedown', e => hits.push(e.target.className));`)
+ const click = async (selector, expected) => {
+ const point = await js(`(() => {
+ const viewport = document.querySelector('.tabbar__tabs').getBoundingClientRect();
+ const el = Array.from(document.querySelectorAll(${JSON.stringify(selector)})).find(el => {
+ const r = el.getBoundingClientRect();
+ return !el.closest('.tabbar__tabs') || (r.left >= viewport.left && r.right <= viewport.right);
+ });
+ if (!el) throw new Error('No fully visible target: ' + ${JSON.stringify(selector)});
+ const r = el.getBoundingClientRect(); return {x:r.x+r.width/2, y:r.y+r.height/2};
+ })()`)
+ const bounds = win.getContentBounds()
+ nativeClick(Math.round(bounds.x + point.x), Math.round(bounds.y + point.y))
+ await pause()
+ const hits = await js('hits.splice(0)')
+ assert.deepEqual(hits, expected, `${selector}: native hit test`)
+ }
+ let cases = 0
+ for (const inset of [false, true]) {
+ for (const height of [28, 40, 64]) {
+ await js(`document.documentElement.dataset.windowChrome=${JSON.stringify(inset ? 'inset' : '')}; document.documentElement.style.setProperty('--tabbar-h','${height}px')`)
+ for (const scroll of [0, 1, 100, 1800, 99999, 0]) {
+ await js(`document.querySelector('.tabbar__tabs').scrollLeft=${scroll}`)
+ await pause()
+ await click('.brand__name', []) // Native drag areas must NOT deliver a renderer mousedown.
+ await click('.tab__name', ['tab__name'])
+ await click('.tab__caret', ['tab__caret'])
+ await click('.tab__edit', ['tab__edit'])
+ assert.equal(await js(`document.activeElement.className`), 'tab__edit')
+ await click('.tab-add', ['tab-add'])
+ cases++
+ }
+ }
+ }
+ // With few tabs, the unused project area remains a drag handle too.
+ await js(`Array.from(document.querySelectorAll('.tab')).slice(1).forEach(el=>el.remove()); document.querySelector('.tabbar__tabs').scrollLeft=0`)
+ await pause()
+ const gap = await js(`(() => {const r=document.querySelector('.tab-add').getBoundingClientRect();return {x:r.right+30,y:r.y+r.height/2}})()`)
+ const bounds = win.getContentBounds()
+ nativeClick(Math.round(bounds.x+gap.x), Math.round(bounds.y+gap.y))
+ await pause()
+ assert.deepEqual(await js('hits.splice(0)'), [])
+ console.log('TABBAR_RESULT ' + JSON.stringify({ electron: process.versions.electron, cases, nativeHitTests: cases * 5 + 1 }))
+ app.quit()
+}).catch(error => { console.error(error); app.exit(1) })
diff --git a/scripts/tabbar-drag.test.ts b/scripts/tabbar-drag.test.ts
new file mode 100644
index 000000000..42eed4172
--- /dev/null
+++ b/scripts/tabbar-drag.test.ts
@@ -0,0 +1,35 @@
+import { spawnSync } from 'node:child_process'
+import { mkdtempSync, rmSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import { join, resolve } from 'node:path'
+import { createRequire } from 'node:module'
+import { expect, it } from 'vitest'
+
+const require = createRequire(import.meta.url)
+// Native X11 hit testing needs these optional system tools; never drive the user's display.
+const available = process.platform === 'linux' &&
+ spawnSync('sh', ['-c', 'command -v xvfb-run && command -v xauth && command -v python3'], { stdio: 'ignore' }).status === 0 &&
+ spawnSync('python3', ['-c', "import ctypes; ctypes.CDLL('libX11.so.6'); ctypes.CDLL('libXtst.so.6')"], { stdio: 'ignore' }).status === 0
+
+it.skipIf(!available)('keeps the wordmark draggable and the scrolled tabs interactive in real Electron', () => {
+ const profile = mkdtempSync(join(tmpdir(), 'nodeterm-tabbar-test-'))
+ try {
+ const env = { ...process.env }
+ delete env.ELECTRON_RUN_AS_NODE
+ const run = spawnSync('xvfb-run', ['-a', require('electron'), '--no-sandbox',
+ resolve('scripts/tabbar-drag.electron.cjs'), profile, resolve('src/renderer/styles.css')], {
+ cwd: profile, env, encoding: 'utf8', timeout: 55_000, stdio: ['ignore', 'pipe', 'pipe']
+ })
+ expect(run.error).toBeUndefined()
+ expect(run.status, run.stderr + run.stdout).toBe(0)
+ const output = run.stdout
+ const line = output.split('\n').find(line => line.startsWith('TABBAR_RESULT '))
+ expect(line, output).toBeDefined()
+ const result = JSON.parse(line!.slice('TABBAR_RESULT '.length))
+ expect(result.cases).toBe(36)
+ expect(result.nativeHitTests).toBe(181)
+ console.log(result)
+ } finally {
+ rmSync(profile, { recursive: true, force: true })
+ }
+}, 60_000)
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index babcf9444..d9175e218 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -305,10 +305,12 @@ body,
pointer-events: none;
}
-/* Interactive elements inside the bar must not drag the window. */
-.tabbar button,
-.tabbar input,
-.tab,
+/* Only the stationary strip viewport excludes window dragging. Electron includes explicit
+ no-drag rectangles from scrolled-out descendants without clipping them to the viewport
+ (issue #847), so tab/button/input rectangles would cover the wordmark after scrolling.
+ Children need no region of their own: the viewport already keeps them interactive. */
+.tabbar button:not(.tabbar__tabs *),
+.tabbar input:not(.tabbar__tabs *),
.tabbar__tabs {
-webkit-app-region: no-drag;
}