Pointer events
Slap yourself if
You think pointer events are just mouse events with touch support.
Why this exists
Pointer events exist because mouse, touch, and pen are not separate interaction models anymore. Treating them as such creates duplicated logic, inconsistent behavior, and bugs that only appear on real devices.
Mental model
Pointer events unify input by modeling intent, not hardware. A pointer is a stream of interactions with identity, state, and lifecycle — not just a click.
- The browser abstracts mouse, touch, and pen into pointer streams.
- Each pointer has an identity, type, and lifecycle.
- Capture and release determine which element owns the interaction.
- Events are normalized but not identical across input types.
- Mixing pointer and mouse events on the same elements.
- Ignoring pointer capture and losing events mid-interaction.
- Assuming hover semantics apply to touch.
- Treating pointercancel as rare or ignorable.
Pointer events provide a unified input model for mouse, touch, and pen, exposing pointer identity and lifecycle so interactions can be handled consistently across devices.
- Duplicate handlers for mouse and touch
- Drag logic without pointer capture
- Code assuming a single active pointer
- Bugs that only reproduce on touch devices
Deep dive
Requires Pro
Premium deep dives include more internals, more scars.