Pointer Events Level 3 heads for Recommendation

Smooth curves of orange and pink sandstone inside a slot canyon in northern Arizona, lit from above

The World Wide Web Consortium (W3C) has proposed advancing Pointer Events Level 3 to Recommendation, the final step for a web standard. Level 3 adds the pieces that drawing, canvas, and drag-heavy interfaces have been reaching for through browser-specific tricks: a pointerrawupdate event that fires as fast as the hardware reports, getCoalescedEvents() to recover the samples a browser merged into one pointermove, getPredictedEvents() to shave perceived latency, and altitudeAngle and azimuthAngle for pen orientation. It also settles that click, auxclick, and contextmenu are pointer events, which simplifies a lot of component code.

The part I find telling is how long this took. Level 1 was a standard a decade ago, and plenty of codebases I have seen still handle mouse events and touch events separately, with pointer events bolted on as a third path. Three code paths for one gesture, each with its own bugs.

My view is that a component library today should be written against PointerEvent alone. Every current browser supports it, Level 3 fills the remaining gaps, and the mouse and touch handlers are now maintenance without a purpose. Removing them is one of the rare refactors that deletes code, fixes bugs, and makes the pen and touch experience better in the same change.

Does your component library still have separate mouse and touch handlers, and does anyone know why?

Photo source: https://photos.robertstowe.com/northern-arizona