Skip to content

Conversation

@ImmanuelBaskaran
Copy link
Contributor

@ImmanuelBaskaran ImmanuelBaskaran commented Apr 29, 2025

This PR changes which element the handlePointerUp event handler is added to, it now adds the event handler to the body element of each owner docment where a panelResizeHandle is rendered. This accounts for use cases where the panelResizeHandle is rendered in a document that is in a child window.

This PR also adds a test for checking which document body the event handler is added to, which demonstrates a usecase where PanelResizeHandles are rendered to a separate document.

addresses #468

@vercel
Copy link

vercel bot commented Apr 29, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-resizable-panels ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 2, 2025 0:10am

dispatchPointerEvent("pointerup", leftElement);
});

expect(separateWindowDocument.body.addEventListener).toHaveBeenCalledWith("pointerup", expect.anything(), expect.anything());
Copy link
Contributor Author

@ImmanuelBaskaran ImmanuelBaskaran Apr 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This checks if addEventListener is called to add the handlePointerUp to the body element. I am looking into a stricter matcher than expect.anything for checking the callback being added

@bvaughn bvaughn merged commit 3fd7071 into bvaughn:main May 2, 2025
6 checks passed
@bvaughn
Copy link
Owner

bvaughn commented May 2, 2025

Published in [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants