DEV Community

Stephen Charles Weiss
Stephen Charles Weiss

Posted on • Originally published at stephencharlesweiss.com on

5 1

Replacing MouseEvents with PointerEvents

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.

pointerFigure1A 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.

Resources:

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more