bvaughn / react-resizable-panels

https://react-resizable-panels.vercel.app/
MIT License
3.58k stars 124 forks source link

Prevent pointer events from triggering on elements behind hitAreaMargins #338

Closed 4nnikaf closed 2 months ago

4nnikaf commented 2 months ago

Fixing a problem described in #336

To solve the issue of click events passing through the hitAreaMargins to the elements behind them all we need to do is handle the events in the capture phase and prevent them from bubbling down to the children/panel content by calling event.stopPropagation().

However cancelling the mouse/touch events (for exmaple mousedown/touchstart), does not cancel their pointer event counterparts (pointerdown), like it does the other way around. So I also changed the event handlers to listen to the pointer events instead.

vercel[bot] commented 2 months ago

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 Apr 15, 2024 2:39pm
bvaughn commented 2 months ago

Thanks for the PR. I'm preparing a release in #339.