Open justthatrio opened 3 months ago
Thanks for the report! You're right - I'm currently defaulting to pointer events if possible since they're modern, but now that I check, the Pointer API just doesn't emit any "down" events for chorded mouse buttons.
It looks like there's an easy but hacky workaround, at least in Chrome... or it might make sense for this library to just use mousedown
events. Let me think about this a little and I'll hack something out.
You could use both pointer and mouse event listeners and let the mouse ones take precedence, ignoring pointer events if a corresponding mouse event was received. That would allow supporting mobile devices without feature detection and greater backwards compatibility for older browsers that don't support point events, and handle the edge that some browsers send both mouse and pointer events for mouse devices, but only pointer events for touch inputs.
When both the left and right mouse keys are released at the same, the release of the left mouse key is not detected. Whichever mouse key was pressed first is the key that gets stuck. The behavior is repeatable on the live demo.
Edit: The bug seems to not be timing related but rather related to the order of events. If you press left, then press right, then release left, then release right, the left will remain detected as pressed despite it not being.