This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2020.
* Some parts of this feature may have varying levels of support.
The PointerEvent interface represents the state of a DOM event produced by a pointer such as the geometry of the contact point, the device type that generated the event, the amount of pressure that was applied on the contact surface, etc.
A pointer is a hardware agnostic representation of input devices (such as a mouse, pen or contact point on a touch-enable surface). The pointer can target a specific coordinate (or set of coordinates) on the contact surface such as a screen.
A pointer's hit test is the process a browser uses to determine the target element for a pointer event. Typically, this is determined by considering the pointer's location and also the visual layout of elements in a document on screen media.
PointerEvent()Creates a synthetic—and untrusted—PointerEvent.
This interface inherits properties from MouseEvent and Event.
PointerEvent.altitudeAngle Read only
Represents the angle between a transducer (a pointer or stylus) axis and the X-Y plane of a device screen.
PointerEvent.azimuthAngle Read only
Represents the angle between the Y-Z plane and the plane containing both the transducer (a pointer or stylus) axis and the Y axis.
PointerEvent.persistentDeviceId Read only
A unique identifier for the pointing device generating the PointerEvent.
PointerEvent.pointerId Read only
A unique identifier for the pointer causing the event.
PointerEvent.width Read only
The width (magnitude on the X axis), in CSS pixels, of the contact geometry of the pointer.
PointerEvent.height Read only
The height (magnitude on the Y axis), in CSS pixels, of the contact geometry of the pointer.
PointerEvent.pressure Read only
The normalized pressure of the pointer input in the range 0 to 1, where 0 and 1 represent the minimum and maximum pressure the hardware is capable of detecting, respectively.
PointerEvent.tangentialPressure Read only
The normalized tangential pressure of the pointer input (also known as barrel pressure or cylinder stress) in the range -1 to 1, where 0 is the neutral position of the control.
PointerEvent.tiltX Read only
The plane angle (in degrees, in the range of -90 to 90) between the Y–Z plane and the plane containing both the pointer (e.g., pen stylus) axis and the Y axis.
PointerEvent.tiltY Read only
The plane angle (in degrees, in the range of -90 to 90) between the X–Z plane and the plane containing both the pointer (e.g., pen stylus) axis and the X axis.
PointerEvent.twist Read only
The clockwise rotation of the pointer (e.g., pen stylus) around its major axis in degrees, with a value in the range 0 to 359.
PointerEvent.pointerType Read only
Indicates the device type that caused the event (mouse, pen, touch, etc.).
PointerEvent.isPrimary Read only
Indicates if the pointer represents the primary pointer of this pointer type.
PointerEvent.getCoalescedEvents() Secure context
Returns a sequence of all PointerEvent instances that were coalesced into the dispatched pointermove event.
PointerEvent.getPredictedEvents()Returns a sequence of PointerEvent instances that the browser predicts will follow the dispatched pointermove event's coalesced events.
The PointerEvent interface has several event types. To determine which event fired, look at the event's type property.
Note: It's important to note that in many cases, both pointer and mouse events get sent (in order to let non-pointer-specific code still interact with the user). If you use pointer events, you should call preventDefault() to keep the mouse event from being sent as well.
pointeroverThis event is fired when a pointing device is moved into an element's hit test boundaries.
pointerenterThis event is fired when a pointing device is moved into the hit test boundaries of an element or one of its descendants, including as a result of a pointerdown event from a device that does not support hover (see pointerdown). This event type is similar to pointerover, but differs in that it does not bubble.
pointerdownThe event is fired when a pointer becomes active. For mouse, it is fired when the device transitions from no buttons pressed to at least one button pressed. For touch, it is fired when physical contact is made with the digitizer. For pen, it is fired when the stylus makes physical contact with the digitizer.
Note: For touchscreen browsers that allow direct manipulation, a pointerdown event triggers implicit pointer capture, which causes the target to capture all subsequent pointer events as if they were occurring over the capturing target. Accordingly, pointerover, pointerenter, pointerleave, and pointerout will not fire as long as this capture is set. The capture can be released manually by calling element.releasePointerCapture on the target element, or it will be implicitly released after a pointerup or pointercancel event.
pointermoveThis event is fired when a pointer changes coordinates.
pointerrawupdate Experimental
This event is fired when any of a pointer's properties change.
pointerupThis event is fired when a pointer is no longer active.
pointercancelA browser fires this event if it concludes the pointer will no longer be able to generate events (for example the related device is deactivated).
pointeroutThis event is fired for several reasons including: pointing device is moved out of the hit test boundaries of an element; firing the pointerup event for a device that does not support hover (see pointerup); after firing the pointercancel event (see pointercancel); when a pen stylus leaves the hover range detectable by the digitizer.
pointerleaveThis event is fired when a pointing device is moved out of the hit test boundaries of an element. For pen devices, this event is fired when the stylus leaves the hover range detectable by the digitizer.
gotpointercaptureThis event is fired when an element receives pointer capture.
lostpointercaptureThis event is fired after pointer capture is released for a pointer.
Examples of each property, event type, and global event handler are included in their respective reference pages.
| Specification |
|---|
| Pointer Events> # pointerevent-interface> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
PointerEvent |
55 | 12 | 59 | 42 | 13 | 55 | 79 | 42 | 13 | 6.0 | 55 | 13 |
PointerEvent |
55 | 12 | 59 | 42 | 13 | 55 | 79 | 42 | 13 | 6.0 | 55 | 13 |
altitudeAngle |
86 | 86 | 131 | 72 | 18.2 | 86 | 131 | 61 | 18.2 | 14.0 | 86 | 18.2 |
azimuthAngle |
86 | 86 | 131 | 72 | 18.2 | 86 | 131 | 61 | 18.2 | 14.0 | 86 | 18.2 |
getCoalescedEvents |
58 | 79 | 59 | 45 | 18.2 | 58 | 79The method always returns an empty array, regardless of the user's actions. |
43 | 18.2 | 7.0 | 58 | 18.2 |
getPredictedEvents |
77 | 79 | 89 | 64 | 18.2 | 77 | 89 | 55 | 18.2 | 12.0 | 77 | 18.2 |
height |
55 | 12 | 59 | 42 | 13 | 55 | 79 | 42 | 13 | 6.0 | 55 | 13 |
isPrimary |
55 | 12 | 59 | 42 | 13 | 55 | 79 | 42 | 13 | 6.0 | 55 | 13 |
persistentDeviceId |
128 | 128 | 141 | 114 | No | 128 | 141 | 85 | No | 28.0 | 128 | No |
pointerId |
55 | 12 | 59 | 42 | 13 | 55 | 79 | 42 | 13 | 6.0 | 55 | 13 |
pointerType |
55 | 12 | 59 | 42 | 13 | 55 | 79 | 42 | 13 | 6.0 | 55 | 13 |
pressure |
55 | 12 | 59 | 42 | 13 | 55 | 79 | 42 | 13 | 6.0 | 55 | 13 |
tangentialPressure |
57 | 79 | 59 | 44 | 13 | 57 | 79 | 43 | 13 | 7.0 | 57 | 13 |
tiltX |
55 | 12 | 59 | 42 | 13 | 55 | 79 | 42 | 13 | 6.0 | 55 | 13 |
tiltY |
55 | 12 | 59 | 42 | 13 | 55 | 79 | 42 | 13 | 6.0 | 55 | 13 |
twist |
57 | 18 | 59 | 44 | 13 | 57 | 79 | 43 | 13 | 7.0 | 57 | 13 |
width |
55 | 12 | 59 | 42 | 13 | 55 | 79 | 42 | 13 | 6.0 | 55 | 13 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent