From e04d904eb7807d4aa32eb879e855b9e4fe65ecbb Mon Sep 17 00:00:00 2001 From: Antigravity AI Date: Thu, 4 Jun 2026 18:23:30 +1200 Subject: [PATCH] fix(ui): stabilize bottom-panel resize drag on webkit Guard the resize pointermove handler with an isDraggingRef flag instead of hasPointerCapture(), which behaves inconsistently across webkit versions in CI for repeated drag sequences. setPointerCapture still delivers move/up events when the pointer leaves the handle bounds. Salvaged from the retired feat/phase-2-auth-gate branch (orig d91cc429); the setPointerCapture work it built on is already on main. --- package.json | 2 +- src/components/layout/BottomPanelManager.tsx | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 455fb7af..5be1f7c5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "worldwideview", - "version": "2.48.14", + "version": "2.48.15", "private": true, "type": "module", "packageManager": "pnpm@9.15.4", diff --git a/src/components/layout/BottomPanelManager.tsx b/src/components/layout/BottomPanelManager.tsx index 043b95ee..77d735b3 100644 --- a/src/components/layout/BottomPanelManager.tsx +++ b/src/components/layout/BottomPanelManager.tsx @@ -24,6 +24,7 @@ export function BottomPanelManager() { ); const isCoveredRef = useRef(false); + const isDraggingRef = useRef(false); useEffect(() => { if (activeBottomPanel) { @@ -39,17 +40,18 @@ export function BottomPanelManager() { }, [activeBottomPanel]); // Pointer-capture drag handlers — attached directly to the resize handle element. - // Using setPointerCapture ensures pointermove/pointerup are delivered to the - // element even when the pointer leaves it, which is required for webkit - // (without capture, webkit drops synthetic pointermove events from Playwright - // and from fast real-user drags that leave the element bounds). + // setPointerCapture ensures pointermove/pointerup are delivered to the element even + // when the pointer leaves its bounds (required for fast real-user drags and Playwright). + // isDraggingRef guards the move handler instead of hasPointerCapture, which has + // inconsistent behaviour across webkit versions in CI for repeated drag sequences. const handleResizePointerDown = (e: React.PointerEvent) => { e.currentTarget.setPointerCapture(e.pointerId); + isDraggingRef.current = true; document.body.classList.add("is-dragging-bottom-panel"); }; const handleResizePointerMove = (e: React.PointerEvent) => { - if (!e.currentTarget.hasPointerCapture(e.pointerId)) return; + if (!isDraggingRef.current) return; const newHeight = window.innerHeight - e.clientY; const clampedHeight = Math.max(120, Math.min(newHeight, window.innerHeight - 100)); setBottomPanelHeight(clampedHeight); @@ -57,6 +59,7 @@ export function BottomPanelManager() { const handleResizePointerUp = (e: React.PointerEvent) => { e.currentTarget.releasePointerCapture(e.pointerId); + isDraggingRef.current = false; document.body.classList.remove("is-dragging-bottom-panel"); };