/* Code Comments */

Replacing MouseEvents with PointerEvents

August 14, 2019

How can the necessity of handling different types of inputs (e.g., mouse, touch, and pen) by duplicating event handler logic? The Pointer Event makes a compelling case that it’s a solid solution.

pointer Figure1A pointer is a hardware agnostic representation of input devices that can target a specific coordinate (or set of coordinates) on a screen. 1

Pointer Events provide all the usual properties present in Mouse Events (client coordinates, target element, button states, etc.) in addition to new properties for other forms of input: pressure, contact geometry, tilt, etc. 2

While Pointer Events are not yet supported by all browsers, there is wide adoption among major modern browsers (Safari being the major exception, though support is coming in v13).3

can i use pointer events

This is a boon as pointer events will make the act of dealing with different input events much simpler.

Footnotes:


Stephen Weiss

Thanks for reading! My name's Stephen Weiss. I live in Chicago with my wife, Kate, and dog, Finn.
Click here to see the archives of my weeks in review and sign up yourself!