Skip to content

The agent that grows with you

fix(desktop): require a deliberate drag to peel the composer out

Brooklyn Nicholson4b1da972991f
diff --git a/apps/desktop/src/app/chat/composer/hooks/use-popout-drag.test.tsx b/apps/desktop/src/app/chat/composer/hooks/use-popout-drag.test.tsx
index 5c0465d6ade..79e84186287 100644
--- a/apps/desktop/src/app/chat/composer/hooks/use-popout-drag.test.tsx
+++ b/apps/desktop/src/app/chat/composer/hooks/use-popout-drag.test.tsx
@@ -27,10 +27,10 @@ function GestureHarness({ onPopOut }: { onPopOut: () => void }) {
)
}
-function dragUp(target: Element) {
+function dragUp(target: Element, deltaY = 64) {
fireEvent.pointerDown(target, { button: 0, clientX: 100, clientY: 100, pointerId: 7 })
- fireEvent.pointerMove(window, { clientX: 100, clientY: 60, pointerId: 7 })
- fireEvent.pointerUp(window, { clientX: 100, clientY: 60, pointerId: 7 })
+ fireEvent.pointerMove(window, { clientX: 100, clientY: 100 - deltaY, pointerId: 7 })
+ fireEvent.pointerUp(window, { clientX: 100, clientY: 100 - deltaY, pointerId: 7 })
}
afterEach(cleanup)
@@ -62,4 +62,15 @@ describe('useComposerPopoutGestures', () => {
expect(onPopOut).toHaveBeenCalledOnce()
})
+
+ // #101318: a stray click-drag on the grab ring undocked the composer.
+ it('does not peel out on a short brush of the drag region', () => {
+ const onPopOut = vi.fn()
+ render(<GestureHarness onPopOut={onPopOut} />)
+
+ dragUp(screen.getByTestId('drag-region'), 16)
+ dragUp(screen.getByTestId('drag-region'), 40)
+
+ expect(onPopOut).not.toHaveBeenCalled()
+ })
})
diff --git a/apps/desktop/src/app/chat/composer/hooks/use-popout-drag.ts b/apps/desktop/src/app/chat/composer/hooks/use-popout-drag.ts
index f48ce6ef9b8..9b1e213f707 100644
--- a/apps/desktop/src/app/chat/composer/hooks/use-popout-drag.ts
+++ b/apps/desktop/src/app/chat/composer/hooks/use-popout-drag.ts
@@ -15,7 +15,8 @@ import {
const LONG_PRESS_MS = 360
const LONG_PRESS_MOVE_TOLERANCE = 10
// Upward drag distance from the docked composer that peels it off into a float.
-const PEEL_OUT_PX = 16
+// Deliberate, not a brush: 16px undocked it on stray click-drags (#101318).
+const PEEL_OUT_PX = 48
const DOCK_ZONE_BOTTOM_PX = 72
// How close the composer's center must be to the viewport center (px) to count as
// "over the dock". Kept tight so the bottom-left/right corners stay free.