Skip to content

The agent that grows with you

fix(desktop): scope the salvaged fix to the failure-path removal

yoniebans001a4c91c62a
diff --git a/apps/desktop/src/components/pane-shell/tree/renderer/drag-session.ts b/apps/desktop/src/components/pane-shell/tree/renderer/drag-session.ts
index 6066bb0eab1..826f15d4b91 100644
--- a/apps/desktop/src/components/pane-shell/tree/renderer/drag-session.ts
+++ b/apps/desktop/src/components/pane-shell/tree/renderer/drag-session.ts
@@ -158,7 +158,7 @@ const sameHint = (a: DropHint | null, b: DropHint | null) =>
/** Double-tap detection for drag handles. Pane handles preventDefault
* pointerdown, which suppresses native `dblclick` — so rapid same-handle
* taps are detected here instead. */
-export const DOUBLE_TAP_MS = 400
+const DOUBLE_TAP_MS = 400
let lastTap: { key: string; time: number } | null = null
export interface DoubleTapContext {
diff --git a/apps/desktop/src/components/pane-shell/tree/renderer/tab-strip-hide.test.tsx b/apps/desktop/src/components/pane-shell/tree/renderer/tab-strip-hide.test.tsx
index 4851e3ffdf4..415c87965fa 100644
--- a/apps/desktop/src/components/pane-shell/tree/renderer/tab-strip-hide.test.tsx
+++ b/apps/desktop/src/components/pane-shell/tree/renderer/tab-strip-hide.test.tsx
@@ -16,10 +16,8 @@ function LiveTreeGroup() {
return <TreeGroup node={zoneAt(0)} parentAxis="column" />
}
-// Pins the tab-strip hide/recovery grammar: hiding the strip is an EXPLICIT
-// verb (zone menu / main tab menu) — a double-click on a tab must NOT vanish
-// the bar (it used to, stranding the zone with no ✕), and a double-tap on the
-// zone body restores a strip that WAS hidden explicitly.
+// Pins the tab-strip hide grammar: the double-tap hide belongs to the STRIP
+// BACKGROUND alone — tabs are activate-only and must never hide the bar.
class TestResizeObserver {
observe() {}
@@ -74,14 +72,18 @@ const groupNode = () => {
return (node.type === 'split' ? node.children[0] : node) as { headerHidden?: boolean; panes: string[] }
}
-const tablist = () => document.querySelector('[role="tablist"]')
+const tablist = () => globalThis.document.querySelector('[role="tablist"]')
-const doublePointerDown = (target: Element) => {
- fireEvent.pointerDown(target, { button: 0, pointerType: 'mouse' })
- fireEvent.pointerDown(target, { button: 0, pointerType: 'mouse' })
+/** Two sub-threshold taps: pointerdown on the target, pointerup on window
+ * (drag-session listens there), twice — the synthesized double-tap path. */
+const doubleTap = (target: Element) => {
+ for (let i = 0; i < 2; i++) {
+ fireEvent.pointerDown(target, { button: 0, clientX: 10, clientY: 10, pointerType: 'mouse' })
+ fireEvent.pointerUp(window, { button: 0, clientX: 10, clientY: 10, pointerType: 'mouse' })
+ }
}
-describe('tab strip hide/recovery grammar', () => {
+describe('tab strip hide grammar', () => {
it('double-clicking a tab does NOT hide the strip', () => {
// $layoutTree.set, not declareDefaultTree — the latter only adopts into an
// existing tree, and the store is module state that survives between tests.
@@ -90,44 +92,27 @@ describe('tab strip hide/recovery grammar', () => {
)
render(<LiveTreeGroup />)
- const tab = document.querySelector<HTMLElement>('[data-tree-tab="terminal"]')
+ const tab = globalThis.document.querySelector<HTMLElement>('[data-tree-tab="terminal"]')
expect(tab).toBeTruthy()
- doublePointerDown(tab!)
+ doubleTap(tab!)
// The strip is still there and the tree never recorded a hide.
expect(tablist()).toBeTruthy()
expect(groupNode().headerHidden).not.toBe(true)
})
- it('double-tapping the zone body restores an explicitly hidden strip', () => {
+ it('double-tapping the strip background still hides the header (documented gesture)', () => {
$layoutTree.set(
- split('column', [group(['terminal'], { active: 'terminal', headerHidden: true, id: 'grp-tools' })])
+ split('column', [group(['workspace', 'terminal'], { active: 'terminal', id: 'grp-main' })])
)
render(<LiveTreeGroup />)
- // Hidden strip: no tablist, no ✕ anywhere in the zone.
- expect(tablist()).toBeNull()
-
- const body = document.querySelector<HTMLElement>('[data-tree-group="grp-tools"]')
- expect(body).toBeTruthy()
-
- doublePointerDown(body!)
-
- expect(tablist()).toBeTruthy()
- expect(groupNode().headerHidden).toBe(false)
- })
-
- it('a single body tap does not toggle the strip back', () => {
- $layoutTree.set(
- split('column', [group(['terminal'], { active: 'terminal', headerHidden: true, id: 'grp-tools' })])
- )
- render(<LiveTreeGroup />)
+ const strip = globalThis.document.querySelector<HTMLElement>('[data-zone-tabstrip="grp-main"]')
+ expect(strip).toBeTruthy()
- const body = document.querySelector<HTMLElement>('[data-tree-group="grp-tools"]')!
- fireEvent.pointerDown(body, { button: 0, pointerType: 'mouse' })
+ doubleTap(strip!)
- expect(tablist()).toBeNull()
expect(groupNode().headerHidden).toBe(true)
})
})
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.tsx
index 94bae355a72..8f269dc1a72 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
@@ -10,15 +10,7 @@
*/
import { useStore } from '@nanostores/react'
-import {
- type CSSProperties,
- Fragment,
- type ReactNode,
- type PointerEvent as ReactPointerEvent,
- type RefObject,
- useRef,
- useState
-} from 'react'
+import { type CSSProperties, Fragment, type ReactNode, type RefObject, useRef, useState } from 'react'
import { ActionsContextMenu, type MenuKit, renderActionItem } from '@/components/ui/actions-menu'
import { Codicon } from '@/components/ui/codicon'
@@ -79,7 +71,7 @@ import {
toggleTabSelected
} from '../tab-selection'
-import { DOUBLE_TAP_MS, type DoubleTapContext, startPaneDrag } from './drag-session'
+import { type DoubleTapContext, startPaneDrag } from './drag-session'
import { forceLoneHeaderForPanes } from './lone-header'
import { useActiveTabVisible } from './tab-strip-scroll'
import { paneChrome } from './track-model'
@@ -299,14 +291,10 @@ export function TreeGroup({
tabCount: shown.length
})
- // The STRIP background keeps the synthesized double-tap hide — it is the
- // documented explicit gesture (model.ts) and the open PR #84458 reveal edge
- // is its recovery for that surface. TABS must not carry it: a tab is where
- // people double-click for mundane reasons (select a title, retry a click),
- // and every tab drag forwarded the gesture, so a routine double-click
- // vanished the whole bar and stranded the zone with no ✕ and no way back
- // but a right-click. The body below carries the inverse gesture as the
- // recovery path when a strip IS hidden.
+ // The STRIP background owns the synthesized double-tap hide — it is the
+ // documented explicit gesture (model.ts). TABS never carry it: a tab is
+ // where people double-click for mundane reasons (select a title, retry a
+ // click), so tab presses pass no double-tap context and stay activate-only.
const hideHeaderDoubleTap: DoubleTapContext = {
key: `hide-header-${node.id}`,
onDoubleTap: () => {
@@ -315,38 +303,6 @@ export function TreeGroup({
}
}
- // Recovery for an explicitly hidden strip: double-tap the zone BODY brings
- // the bar back. The body is otherwise inert (panes own their clicks; drags
- // engage past a movement threshold), so the gesture can't fire by accident.
- const showHeaderDoubleTap: DoubleTapContext = {
- key: `show-header-${node.id}`,
- onDoubleTap: () => setTreeGroupHeaderHidden(node.id, false)
- }
-
- const bodyTapRef = useRef<{ time: number; x: number; y: number } | null>(null)
-
- const onBodyPointerDown = (event: ReactPointerEvent<HTMLDivElement>) => {
- if (event.button !== 0 || !headerHidden || node.minimized || editMode) {
- return
- }
-
- const now = Date.now()
- const last = bodyTapRef.current
-
- if (
- last &&
- now - last.time < DOUBLE_TAP_MS &&
- Math.hypot(event.clientX - last.x, event.clientY - last.y) < 24
- ) {
- bodyTapRef.current = null
- showHeaderDoubleTap.onDoubleTap()
-
- return
- }
-
- bodyTapRef.current = { time: now, x: event.clientX, y: event.clientY }
- }
-
// Zone-menu close targets read the layout tree, but this component must NOT
// subscribe to it: `useStore($layoutTree)` here wires every zone — and
// therefore every mounted pane and its whole transcript — to the entire
@@ -400,10 +356,11 @@ export function TreeGroup({
targetPane
}
- // The bar's lifecycle is explicit: gaining a tab sticky-shows it
- // (insertAtGroup pins headerHidden false), the zone menu (and the main
- // tab's menu) hide it, full-page views veto it via paneChrome.headerVeto,
- // and a double-tap on the body restores it while hidden.
+ // NO body double-click toggle: virtualized content (the thread) recreates
+ // its nodes between clicks, so the gesture was hopelessly unreliable. The
+ // bar's lifecycle is explicit instead — gaining a tab sticky-shows it
+ // (insertAtGroup pins headerHidden false), the main tab's context menu
+ // hides it, and full-page views veto it via paneChrome.headerVeto.
return (
<div
@@ -420,7 +377,6 @@ export function TreeGroup({
onContextMenu={e => {
setMenuPane((e.target as HTMLElement).closest('[data-tree-tab]')?.getAttribute('data-tree-tab') ?? undefined)
}}
- onPointerDown={onBodyPointerDown}
ref={ref}
style={wcOverlap ? { paddingTop: wcOverlap.y + wcOverlap.height } : undefined}
>