π OpenHands: AI-Driven Development
test: strengthen drag resize cleanup (#17358)
aivong-openhandsc055b1ae27e3
diff --git a/__tests__/hooks/use-drag-resize.test.tsx b/__tests__/hooks/use-drag-resize.test.tsxindex 885c85e953..8343f0e73e 100644--- a/__tests__/hooks/use-drag-resize.test.tsx+++ b/__tests__/hooks/use-drag-resize.test.tsx@@ -1,184 +1,551 @@+import type {+ MouseEvent as ReactMouseEvent,+ TouchEvent as ReactTouchEvent,+} from "react";import { act, renderHook } from "@testing-library/react";-import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import { useDragResize } from "#/hooks/use-drag-resize";+import { isMobileDevice } from "#/utils/utils";-// Mock isMobileDevice to always return false so the hook uses the desktop-// event-listener path (document.addEventListener), which our test simulates.vi.mock("#/utils/utils", async (importOriginal) => ({...(await importOriginal<typeof import("#/utils/utils")>()),- isMobileDevice: () => false,+ isMobileDevice: vi.fn(),}));-/**- * Coverage for the top-grip resize direction fix (OHE-3062).- *- * The same chat-input component is used on the conversation page (where the- * input is bottom-anchored) and the home page (where the input is centred).- * On the conversation page, dragging the top grip makes the box grow upward β- * correct. On the home page, the same drag would grow the box downward, which- * is confusing, so the hook disables manual resizing entirely when the input- * is not bottom-anchored.- */-describe("useDragResize β disabled when not bottom-anchored", () => {- let inputEl: HTMLDivElement;- let wrapperEl: HTMLDivElement;- let gripEl: HTMLDivElement;-- // Helper to simulate a drag from startY upward by `distance` px.- const dragUp = (startY: number, distance: number) => {- document.dispatchEvent(- new MouseEvent("mousemove", { clientY: startY - distance }),- );- document.dispatchEvent(new MouseEvent("mouseup", { clientY: startY }));+interface ResizeElementOptions {+ offsetHeight?: number;+ scrollHeight?: number;+}++const createResizeElement = ({+ offsetHeight = 200,+ scrollHeight = 100,+}: ResizeElementOptions = {}) => {+ const element = document.createElement("div");+ Object.defineProperties(element, {+ offsetHeight: { configurable: true, value: offsetHeight },+ scrollHeight: { configurable: true, value: scrollHeight },+ });+ document.body.appendChild(element);+ return element;+};++const createResizeGrip = () => {+ const grip = document.createElement("div");+ grip.id = "resize-grip";+ document.body.appendChild(grip);+ return grip;+};++const createTouchEvent = (type: string, clientYs: number[]) => {+ const event = new Event(type, { bubbles: true, cancelable: true });+ Object.defineProperty(event, "touches", {+ value: clientYs.map((clientY) => ({ clientY })),+ });+ return event as TouchEvent;+};++const beginMouseDrag = (+ handleGripMouseDown: (event: ReactMouseEvent) => void,+ clientY = 100,+) => {+ const preventDefault = vi.fn();+ act(() => {+ handleGripMouseDown({+ clientY,+ preventDefault,+ } as unknown as ReactMouseEvent);+ });+ expect(preventDefault).toHaveBeenCalledOnce();+};++const beginTouchDrag = (+ handleGripTouchStart: (event: ReactTouchEvent) => void,+ clientY = 100,+) => {+ const preventDefault = vi.fn();+ act(() => {+ handleGripTouchStart({+ touches: [{ clientY }],+ preventDefault,+ } as unknown as ReactTouchEvent);+ });+ expect(preventDefault).toHaveBeenCalledOnce();+};++const dispatchDocumentMouseMove = (clientY: number) => {+ const event = new MouseEvent("mousemove", {+ bubbles: true,+ cancelable: true,+ clientY,+ });+ act(() => document.dispatchEvent(event));+ return event;+};++const captureWindowErrors = (action: () => void) => {+ const errors: unknown[] = [];+ const handleError = (event: ErrorEvent) => {+ event.preventDefault();+ errors.push(event.error);};+ window.addEventListener("error", handleError);+ try {+ action();+ } catch (error) {+ errors.push(error);+ } finally {+ window.removeEventListener("error", handleError);+ }+ return errors;+};- beforeEach(() => {- // Build the DOM structure that matches CustomChatInput:- // <div class="relative w-full" id="wrapper"> β wrapper- // <div id="resize-grip"> β grip- // <div class="chat-input-container"> β container- // <div id="inputEl"> β contentEditable (height target)- wrapperEl = document.createElement("div");- wrapperEl.id = "wrapper";-- gripEl = document.createElement("div");- gripEl.id = "resize-grip";-- const containerEl = document.createElement("div");- containerEl.className = "chat-input-container";-- inputEl = document.createElement("div");- inputEl.style.height = "20px";-- containerEl.appendChild(inputEl);- wrapperEl.appendChild(gripEl);- wrapperEl.appendChild(containerEl);- document.body.appendChild(wrapperEl);-- // jsdom doesn't implement offsetHeight; mock it to return the style height.- Object.defineProperty(inputEl, "offsetHeight", {- get() {- return parseFloat(inputEl.style.height || "20");- },- configurable: true,- });+beforeEach(() => {+ // The hook only enables manual resizing when the chat input is+ // "bottom-anchored" (its wrapper's bottom edge sits within+ // BOTTOM_ANCHORED_THRESHOLD px of the viewport bottom). jsdom reports a+ // zeroed getBoundingClientRect, so shrink the viewport to satisfy that+ // check and simulate the conversation-page layout where dragging is active.+ Object.defineProperty(window, "innerHeight", {+ configurable: true,+ value: 100,});+});- afterEach(() => {- wrapperEl.remove();- vi.restoreAllMocks();- });-- it("allows resizing when the input is bottom-anchored", () => {- // Simulate a bottom-anchored layout: the wrapper's bottom is at the- // viewport bottom.- vi.spyOn(wrapperEl, "getBoundingClientRect").mockReturnValue({- top: 668,- bottom: 768, // == window.innerHeight- left: 0,- right: 0,- width: 800,- height: 100,- x: 0,- y: 668,- toJSON: () => ({}),- });- vi.spyOn(window, "innerHeight", "get").mockReturnValue(768);+afterEach(() => {+ document.body.replaceChildren();+ vi.clearAllMocks();+});++describe("manual drag resizing", () => {+ it.each([648, 647])(+ "allows resizing at the bottom-anchor boundary but not just outside it: bottom=%s",+ (bottom) => {+ vi.mocked(isMobileDevice).mockReturnValue(false);+ Object.defineProperty(window, "innerHeight", {+ configurable: true,+ value: 768,+ });+ const wrapper = document.createElement("div");+ wrapper.getBoundingClientRect = () => ({ bottom }) as DOMRect;+ document.body.appendChild(wrapper);+ wrapper.appendChild(createResizeGrip());+ const element = createResizeElement();+ const onHeightChange = vi.fn();+ const { result } = renderHook(() =>+ useDragResize({+ elementRef: { current: element },+ minHeight: 100,+ maxHeight: 300,+ onHeightChange,+ }),+ );+ beginMouseDrag(result.current.handleGripMouseDown);+ dispatchDocumentMouseMove(80);+ act(() => document.dispatchEvent(new MouseEvent("mouseup")));+ if (bottom === 648) {+ expect(element.style.height).toBe("220px");+ expect(onHeightChange).toHaveBeenCalledExactlyOnceWith(220);+ } else {+ expect(element.style.height).toBe("");+ expect(onHeightChange).not.toHaveBeenCalled();+ }+ },+ );++ it.each([false, true])(+ "does not resize a centered home input on mobile=%s",+ (mobile) => {+ vi.mocked(isMobileDevice).mockReturnValue(mobile);+ Object.defineProperty(window, "innerHeight", {+ configurable: true,+ value: 768,+ });+ const wrapper = document.createElement("div");+ wrapper.getBoundingClientRect = () => ({ bottom: 200 }) as DOMRect;+ document.body.appendChild(wrapper);+ const grip = createResizeGrip();+ wrapper.appendChild(grip);+ const element = createResizeElement();+ const onHeightChange = vi.fn();+ const onGripDragStart = vi.fn();+ const { result } = renderHook(() =>+ useDragResize({+ elementRef: { current: element },+ minHeight: 100,+ maxHeight: 300,+ onHeightChange,+ onGripDragStart,+ }),+ );+ if (mobile) {+ beginTouchDrag(result.current.handleGripTouchStart);+ act(() => grip.dispatchEvent(createTouchEvent("touchmove", [80])));+ act(() => grip.dispatchEvent(createTouchEvent("touchend", [])));+ } else {+ beginMouseDrag(result.current.handleGripMouseDown);+ dispatchDocumentMouseMove(80);+ act(() => document.dispatchEvent(new MouseEvent("mouseup")));+ }+ expect(element.style.height).toBe("");+ expect(onHeightChange).not.toHaveBeenCalled();+ expect(onGripDragStart).not.toHaveBeenCalled();+ },+ );+ it("commits a desktop drag at the movement threshold and removes its listeners on release", () => {+ vi.mocked(isMobileDevice).mockReturnValue(false);+ const element = createResizeElement({+ offsetHeight: 200,+ scrollHeight: 220,+ });+ const onGripDragStart = vi.fn();+ const onGripDragEnd = vi.fn();+ const onHeightChange = vi.fn();+ const onReachedMinHeight = vi.fn();const { result } = renderHook(() =>useDragResize({- elementRef: { current: inputEl },- minHeight: 20,- maxHeight: 400,+ elementRef: { current: element },+ minHeight: 100,+ maxHeight: 300,+ onGripDragStart,+ onGripDragEnd,+ onHeightChange,+ onReachedMinHeight,}),);- act(() => {- result.current.handleGripMouseDown(- new MouseEvent("mousedown", {- clientY: 100,- }) as unknown as React.MouseEvent,- );+ beginMouseDrag(result.current.handleGripMouseDown);++ const subThresholdMove = dispatchDocumentMouseMove(99);+ expect(subThresholdMove.defaultPrevented).toBe(true);+ expect(onGripDragStart).not.toHaveBeenCalled();+ expect(onHeightChange).not.toHaveBeenCalled();+ expect(element.style.height).toBe("");++ dispatchDocumentMouseMove(98);+ expect(onGripDragStart).toHaveBeenCalledOnce();+ expect(onHeightChange).toHaveBeenLastCalledWith(202);+ expect(onReachedMinHeight).not.toHaveBeenCalled();+ expect(element.style.height).toBe("202px");+ expect(element.style.overflowY).toBe("auto");++ dispatchDocumentMouseMove(80);+ expect(onGripDragStart).toHaveBeenCalledOnce();+ expect(onHeightChange).toHaveBeenLastCalledWith(220);+ expect(element.style.height).toBe("220px");+ expect(element.style.overflowY).toBe("hidden");++ act(() => document.dispatchEvent(new MouseEvent("mouseup")));+ expect(onGripDragEnd).toHaveBeenCalledOnce();++ dispatchDocumentMouseMove(70);+ act(() => document.dispatchEvent(new MouseEvent("mouseup")));+ expect(onHeightChange).toHaveBeenCalledTimes(2);+ expect(onGripDragEnd).toHaveBeenCalledOnce();+ });++ it("clamps a desktop drag to the minimum and reports the minimum without optional height callbacks", () => {+ vi.mocked(isMobileDevice).mockReturnValue(false);+ const element = createResizeElement({+ offsetHeight: 200,+ scrollHeight: 150,});+ const onReachedMinHeight = vi.fn();+ const { result } = renderHook(() =>+ useDragResize({+ elementRef: { current: element },+ minHeight: 100,+ maxHeight: 300,+ onReachedMinHeight,+ }),+ );- // Drag up 30px β height should increase by 30- act(() => dragUp(100, 30));-- expect(parseFloat(inputEl.style.height)).toBe(50);- });-- it("does NOT resize when the input is not bottom-anchored (home page)", () => {- // Simulate a centred layout: the wrapper's bottom is well above the- // viewport bottom.- vi.spyOn(wrapperEl, "getBoundingClientRect").mockReturnValue({- top: 100,- bottom: 200, // 200 << 768, not bottom-anchored- left: 0,- right: 0,- width: 800,- height: 100,- x: 0,- y: 100,- toJSON: () => ({}),+ beginMouseDrag(result.current.handleGripMouseDown);+ dispatchDocumentMouseMove(400);++ expect(element.style.height).toBe("100px");+ expect(element.style.overflowY).toBe("auto");+ expect(onReachedMinHeight).toHaveBeenCalledOnce();++ const errors = captureWindowErrors(() => {+ act(() => document.dispatchEvent(new MouseEvent("mouseup")));});- vi.spyOn(window, "innerHeight", "get").mockReturnValue(768);+ expect(errors).toEqual([]);+ });+ it("reports a height exactly within the minimum tolerance", () => {+ vi.mocked(isMobileDevice).mockReturnValue(false);+ const element = createResizeElement({+ offsetHeight: 200,+ scrollHeight: 0,+ });+ const onReachedMinHeight = vi.fn();const { result } = renderHook(() =>useDragResize({- elementRef: { current: inputEl },- minHeight: 20,- maxHeight: 400,+ elementRef: { current: element },+ minHeight: 100,+ maxHeight: 300,+ onReachedMinHeight,}),);- act(() => {- result.current.handleGripMouseDown(- new MouseEvent("mousedown", {- clientY: 100,- }) as unknown as React.MouseEvent,- );+ beginMouseDrag(result.current.handleGripMouseDown);+ dispatchDocumentMouseMove(198.5);++ expect(element.style.height).toBe("101.5px");+ expect(onReachedMinHeight).toHaveBeenCalledOnce();++ act(() => document.dispatchEvent(new MouseEvent("mouseup")));+ });++ it("clamps a desktop drag to the maximum and shows a scrollbar even when content fits", () => {+ vi.mocked(isMobileDevice).mockReturnValue(false);+ const element = createResizeElement({+ offsetHeight: 200,+ scrollHeight: 50,});+ const onHeightChange = vi.fn();+ const { result } = renderHook(() =>+ useDragResize({+ elementRef: { current: element },+ minHeight: 100,+ maxHeight: 300,+ onHeightChange,+ }),+ );++ beginMouseDrag(result.current.handleGripMouseDown);+ dispatchDocumentMouseMove(-200);++ expect(element.style.height).toBe("300px");+ expect(element.style.overflowY).toBe("auto");+ expect(onHeightChange).toHaveBeenCalledOnce();+ expect(onHeightChange).toHaveBeenCalledWith(300);++ act(() => document.dispatchEvent(new MouseEvent("mouseup")));+ });++ it("uses the minimum as the starting height when the element has no rendered height", () => {+ vi.mocked(isMobileDevice).mockReturnValue(false);+ const element = createResizeElement({ offsetHeight: 0, scrollHeight: 0 });+ const onHeightChange = vi.fn();+ const { result } = renderHook(() =>+ useDragResize({+ elementRef: { current: element },+ minHeight: 100,+ maxHeight: 300,+ onHeightChange,+ }),+ );++ beginMouseDrag(result.current.handleGripMouseDown);+ dispatchDocumentMouseMove(98);++ expect(element.style.height).toBe("102px");+ expect(element.style.overflowY).toBe("hidden");+ expect(onHeightChange).toHaveBeenCalledWith(102);++ act(() => document.dispatchEvent(new MouseEvent("mouseup")));+ });++ it("ends a committed desktop gesture safely if its resize element disappears", () => {+ vi.mocked(isMobileDevice).mockReturnValue(false);+ const elementRef: { current: HTMLElement | null } = { current: null };+ const onGripDragStart = vi.fn();+ const onGripDragEnd = vi.fn();+ const onHeightChange = vi.fn();+ const { result } = renderHook(() =>+ useDragResize({+ elementRef,+ minHeight: 100,+ maxHeight: 300,+ onGripDragStart,+ onGripDragEnd,+ onHeightChange,+ }),+ );- // Attempt to drag up 30px β should be a no-op- act(() => dragUp(100, 30));+ beginMouseDrag(result.current.handleGripMouseDown);+ const errors = captureWindowErrors(() => dispatchDocumentMouseMove(98));+ act(() => document.dispatchEvent(new MouseEvent("mouseup")));- // Height should NOT have changed- expect(parseFloat(inputEl.style.height)).toBe(20);+ expect(errors).toEqual([]);+ expect(onGripDragStart).toHaveBeenCalledOnce();+ expect(onGripDragEnd).toHaveBeenCalledOnce();+ expect(onHeightChange).not.toHaveBeenCalled();});- it("does NOT resize via touch when not bottom-anchored", () => {- vi.spyOn(wrapperEl, "getBoundingClientRect").mockReturnValue({- top: 100,- bottom: 200,- left: 0,- right: 0,- width: 800,- height: 100,- x: 0,- y: 100,- toJSON: () => ({}),+ it("does not report an uncommitted desktop press as a drag", () => {+ vi.mocked(isMobileDevice).mockReturnValue(false);+ const element = createResizeElement();+ const onGripDragStart = vi.fn();+ const onGripDragEnd = vi.fn();+ const { result } = renderHook(() =>+ useDragResize({+ elementRef: { current: element },+ minHeight: 100,+ maxHeight: 300,+ onGripDragStart,+ onGripDragEnd,+ }),+ );++ beginMouseDrag(result.current.handleGripMouseDown);+ act(() => document.dispatchEvent(new MouseEvent("mouseup")));++ expect(onGripDragStart).not.toHaveBeenCalled();+ expect(onGripDragEnd).not.toHaveBeenCalled();+ });++ it("uses the mouse coordinate when a mouse move has an empty touches collection", () => {+ vi.mocked(isMobileDevice).mockReturnValue(false);+ const element = createResizeElement();+ const onGripDragStart = vi.fn();+ const onHeightChange = vi.fn();+ const { result } = renderHook(() =>+ useDragResize({+ elementRef: { current: element },+ minHeight: 100,+ maxHeight: 300,+ onGripDragStart,+ onHeightChange,+ }),+ );++ beginMouseDrag(result.current.handleGripMouseDown);+ const moveEvent = new MouseEvent("mousemove", {+ bubbles: true,+ cancelable: true,+ clientY: 99,});- vi.spyOn(window, "innerHeight", "get").mockReturnValue(768);+ Object.defineProperty(moveEvent, "touches", { value: [] });+ const errors = captureWindowErrors(() => {+ act(() => document.dispatchEvent(moveEvent));+ });++ expect(errors).toEqual([]);+ expect(moveEvent.defaultPrevented).toBe(true);+ expect(onGripDragStart).not.toHaveBeenCalled();+ expect(onHeightChange).not.toHaveBeenCalled();+ expect(element.style.height).toBe("");++ act(() => document.dispatchEvent(new MouseEvent("mouseup")));+ });+ it("does not start a mobile drag when the resize grip is absent", () => {+ vi.mocked(isMobileDevice).mockReturnValue(true);+ const element = createResizeElement();+ const onGripDragStart = vi.fn();const { result } = renderHook(() =>useDragResize({- elementRef: { current: inputEl },- minHeight: 20,- maxHeight: 400,+ elementRef: { current: element },+ minHeight: 100,+ maxHeight: 300,+ onGripDragStart,}),);- act(() => {- result.current.handleGripTouchStart(- new TouchEvent("touchstart", {- touches: [{ clientY: 100 } as unknown as Touch],- }) as unknown as React.TouchEvent,- );+ beginTouchDrag(result.current.handleGripTouchStart);+ act(() => document.dispatchEvent(createTouchEvent("touchmove", [80])));++ expect(onGripDragStart).not.toHaveBeenCalled();+ expect(element.style.height).toBe("");+ });++ it("resizes from touch input and reports the end of a mobile gesture", () => {+ vi.mocked(isMobileDevice).mockReturnValue(true);+ const element = createResizeElement({+ offsetHeight: 200,+ scrollHeight: 100,});+ const grip = createResizeGrip();+ const target = document.createElement("span");+ grip.appendChild(target);+ target.addEventListener("touchmove", (event) => event.stopPropagation());+ target.addEventListener("touchend", (event) => event.stopPropagation());+ const onGripDragStart = vi.fn();+ const onGripDragEnd = vi.fn();+ const onHeightChange = vi.fn();+ const { result } = renderHook(() =>+ useDragResize({+ elementRef: { current: element },+ minHeight: 100,+ maxHeight: 300,+ onGripDragStart,+ onGripDragEnd,+ onHeightChange,+ }),+ );++ beginTouchDrag(result.current.handleGripTouchStart);+ const moveEvent = createTouchEvent("touchmove", [80]);+ act(() => target.dispatchEvent(moveEvent));++ expect(moveEvent.defaultPrevented).toBe(true);+ expect(onGripDragStart).toHaveBeenCalledOnce();+ expect(onHeightChange).toHaveBeenCalledWith(220);+ expect(element.style.height).toBe("220px");+ expect(element.style.overflowY).toBe("hidden");- // Attempt to drag β should be a no-op- act(() => dragUp(100, 30));+ act(() => target.dispatchEvent(createTouchEvent("touchend", [])));+ expect(onGripDragEnd).toHaveBeenCalledOnce();+ expect(onHeightChange).toHaveBeenCalledOnce();+ });++ it("stops handling mobile capture events after touchend", () => {+ vi.mocked(isMobileDevice).mockReturnValue(true);+ const element = createResizeElement();+ const grip = createResizeGrip();+ const onHeightChange = vi.fn();+ const onGripDragEnd = vi.fn();+ const { result } = renderHook(() =>+ useDragResize({+ elementRef: { current: element },+ minHeight: 100,+ maxHeight: 300,+ onHeightChange,+ onGripDragEnd,+ }),+ );++ beginTouchDrag(result.current.handleGripTouchStart);+ act(() => grip.dispatchEvent(createTouchEvent("touchmove", [80])));+ act(() => grip.dispatchEvent(createTouchEvent("touchend", [])));+ act(() => grip.dispatchEvent(createTouchEvent("touchmove", [70])));+ act(() => grip.dispatchEvent(createTouchEvent("touchend", [])));++ expect(onHeightChange).toHaveBeenCalledExactlyOnceWith(220);+ expect(onGripDragEnd).toHaveBeenCalledOnce();+ expect(element.style.height).toBe("220px");+ });++ it("finishes a mobile drag safely when the grip is detached before touchend", () => {+ vi.mocked(isMobileDevice).mockReturnValue(true);+ const element = createResizeElement();+ const grip = createResizeGrip();+ const onGripDragEnd = vi.fn();+ const { result } = renderHook(() =>+ useDragResize({+ elementRef: { current: element },+ minHeight: 100,+ maxHeight: 300,+ onGripDragEnd,+ }),+ );++ beginTouchDrag(result.current.handleGripTouchStart);+ act(() => grip.dispatchEvent(createTouchEvent("touchmove", [80])));+ grip.remove();+ createResizeGrip(); // A replacement must not receive the old grip's cleanup.+ const errors = captureWindowErrors(() => {+ act(() => grip.dispatchEvent(createTouchEvent("touchend", [])));+ });- expect(parseFloat(inputEl.style.height)).toBe(20);+ act(() => grip.dispatchEvent(createTouchEvent("touchmove", [70])));+ act(() => grip.dispatchEvent(createTouchEvent("touchend", [])));+ expect(errors).toEqual([]);+ expect(onGripDragEnd).toHaveBeenCalledOnce();+ expect(element.style.height).toBe("220px");});});diff --git a/src/hooks/use-drag-resize.ts b/src/hooks/use-drag-resize.tsindex 733ac84d64..afb9ae5659 100644--- a/src/hooks/use-drag-resize.ts+++ b/src/hooks/use-drag-resize.ts@@ -80,6 +80,7 @@ export const useDragResize = ({resizeGrip.addEventListener("touchend", handleDragEnd, {capture: true,});+ return resizeGrip;};// Setup event listeners for desktop devices@@ -96,6 +97,7 @@ export const useDragResize = ({const isMobile = isMobileDevice();const startHeight = elementRef.current?.offsetHeight || minHeight;let dragCommitted = false;+ let resizeGrip: HTMLElement | undefined;const handleDragMove = (moveEvent: MouseEvent | TouchEvent) => {moveEvent.preventDefault();@@ -147,16 +149,12 @@ export const useDragResize = ({}if (isMobile) {- const resizeGrip = document.getElementById("resize-grip");if (!resizeGrip) {return;}- // Remove both mouse and touch event listeners- resizeGrip.removeEventListener("mousemove", handleDragMove);- resizeGrip.removeEventListener("mouseup", handleDragEnd);- resizeGrip.removeEventListener("touchmove", handleDragMove);- resizeGrip.removeEventListener("touchend", handleDragEnd);+ resizeGrip.removeEventListener("touchmove", handleDragMove, true);+ resizeGrip.removeEventListener("touchend", handleDragEnd, true);} else {document.removeEventListener("mousemove", handleDragMove);document.removeEventListener("mouseup", handleDragEnd);@@ -167,7 +165,7 @@ export const useDragResize = ({// Setup event listeners based on device typeif (isMobile) {- setupMobileEventListeners(handleDragMove, handleDragEnd);+ resizeGrip = setupMobileEventListeners(handleDragMove, handleDragEnd);} else {setupDesktopEventListeners(handleDragMove, handleDragEnd);}