You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Replace mousedown/touchstart/touchend with pointerdown/pointerup #878
Is your feature request related to a problem? Please describe.
With the more modern events pointerdown/pointerup you can make use of pointer capture, which makes the whole drag UX better. For example you have better control over the cursor (it will not blink).
Describe the solution you'd like
Replace mousedown/touchstart/touchend with pointerdown/pointerup. But this will also not support as many browsers as the current solution. An alternative would be, to add those events on top. Just call this hook on top for example:
Thanks for the feature request! I've reviewed this and agree it's a worthwhile improvement.
Analysis
Current State
The useResizer hook currently handles mouse and touch events separately with:
handleMouseDown / handleMouseUp / handleMouseMove for mouse
handleTouchStart / handleTouchEnd / handleTouchMove for touch
Global document listeners attached during drag
Pros of Pointer Events
Better cursor control - setPointerCapture() prevents cursor blinking during drag since the element captures all pointer events
Unified event handling - Pointer Events handle mouse, touch, and pen input with a single set of events
Cleaner code - Reduces duplication between mouse and touch handlers
More reliable drag behavior - Captured pointer events continue even if pointer leaves the element
Modern standard - Pointer Events are the recommended approach for handling pointing device input
Cons / Considerations
Browser support - Pointer Events require IE11+ / all modern browsers since ~2017. However, since we already target React 17/18/19 and Node 20+, this isn't a concern
Breaking change for custom dividers - Custom divider components will need to handle onPointerDown instead of onMouseDown/onTouchStart
Decision
Going with full replacement rather than the additive approach because:
The project already targets modern React versions
Pointer Events have excellent browser support (5+ years)
It simplifies the codebase significantly
The existing mouse/touch event split adds unnecessary complexity
@delijah This has been implemented and released in v3.1.0 🎉
The library now uses the Pointer Events API with setPointerCapture() for better drag UX - no more cursor blinking!
What's included:
Unified pointer events (handles mouse, touch, and pen)
Pointer capture for reliable drag behavior
Pointer ID filtering for multi-touch support
Backwards compatible: If you have custom dividers using onMouseDown/onTouchStart/onTouchEnd, they'll continue to work. Those props now delegate to onPointerDown internally (marked as deprecated).
Thanks for the suggestion - let me know if it works for you!
Activity
tomkp commentedon Feb 18, 2026
Thanks for the feature request! I've reviewed this and agree it's a worthwhile improvement.
Analysis
Current State
The
useResizerhook currently handles mouse and touch events separately with:handleMouseDown/handleMouseUp/handleMouseMovefor mousehandleTouchStart/handleTouchEnd/handleTouchMovefor touchPros of Pointer Events
setPointerCapture()prevents cursor blinking during drag since the element captures all pointer eventsCons / Considerations
onPointerDowninstead ofonMouseDown/onTouchStartDecision
Going with full replacement rather than the additive approach because:
feat: replace mouse/touch events with pointer events
tomkp commentedon Feb 18, 2026
@delijah This has been implemented and released in v3.1.0 🎉
The library now uses the Pointer Events API with
setPointerCapture()for better drag UX - no more cursor blinking!What's included:
Backwards compatible: If you have custom dividers using
onMouseDown/onTouchStart/onTouchEnd, they'll continue to work. Those props now delegate toonPointerDowninternally (marked as deprecated).Thanks for the suggestion - let me know if it works for you!
feat: replace mouse/touch events with pointer events (tomkp#879)
delijah commentedon Feb 19, 2026
Wow, amazing. Thank you a lot ! 🙏
delijah commentedon Feb 19, 2026
@tomkp by the way: For
sourceyou could also useevent.pointerTypeif you need more accurate info what the pointer action initiated.feat: expose pointerType in ResizeEvent (#880)
tomkp commentedon Feb 19, 2026
@delijah Good suggestion! Implemented in #880 -
pointerTypeis now available in theResizeEvent:Will be in the next release.
tomkp commentedon Feb 19, 2026
@delijah v3.2.0 has been published to npm with the
pointerTypefeature. 🎉Thanks Tom