Andrew Usher

Web Pointer Events

Pointing at things on the web used to be simple. You had a mouse, you moved it around, sometimes you pushed buttons, and that was it. But this, doesn't work so well on here.

Touch events are good, but to support touch and mouse, you had to support two event models:

elem.addEventListener('mousemove', mouseMoveEvent);
elem.addEventListener('touchmove', touchMoveEvent);

Chrome now enables unified input handling by dispatching PointerEvents:

elem.addEventListener('pointermove', pointerMoveEvent);

Pointer events unify the pointer input model for the browser, bringing touch, pens, and mice together into a single set of events. They're supported in IE11, Edge, Chrome, Opera and partially supported in Firefox.

Data on support for the pointer feature across the major browsers from caniuse.com

If you liked this article and think others should read it, please share it on Twitter!