files/en-us/web/api/touchevent/index.md
{{APIRef("Touch Events")}}
The TouchEvent interface represents an {{domxref("UIEvent")}} which is sent when the state of contacts with a touch-sensitive surface changes. This surface can be a touch screen or trackpad, for example. The event can describe one or more points of contact with the screen and includes support for detecting movement, addition and removal of contact points, and so forth.
Touches are represented by the {{domxref("Touch")}} object; each touch is described by a position, size and shape, amount of pressure, and target element. Lists of touches are represented by {{domxref("TouchList")}} objects.
{{InheritanceDiagram}}
TouchEvent object.This interface inherits properties from its parent, {{domxref("UIEvent")}} and {{domxref("Event")}}.
0.0.1.0.There are several types of event that can be fired to indicate that touch-related changes have occurred. You can determine which of these has happened by looking at the event's {{domxref("event.type", "TouchEvent.type")}} property.
{{domxref("Element/touchstart_event", "touchstart")}}
{{domxref("Element/touchend_event", "touchend")}}
: Sent when the user removes a touch point from the surface; that is, when they lift a finger or stylus from the surface. This is also sent if the touch point moves off the edge of the surface; for example, if the user's finger slides off the edge of the screen.
The event's target is the same {{domxref("element")}}
that received the touchstart event
corresponding to the touch point,
even if the touch point has moved outside that element.
The touch point (or points)
that were removed from the surface
can be found in the {{domxref("TouchList")}}
specified by the changedTouches attribute.
{{domxref("Element/touchmove_event", "touchmove")}}
: Sent when the user moves a touch point along the surface.
The event's target is the same {{domxref("element")}}
that received the touchstart event corresponding to the touch point,
even if the touch point has moved outside that element.
This event is also sent if the values of the radius, rotation angle, or force attributes of a touch point change.
[!NOTE] The rate at which
touchmoveevents is sent is browser-specific, and may also vary depending on the capability of the user's hardware. You must not rely on a specific granularity of these events.
{{domxref("Element/touchcancel_event", "touchcancel")}}
It's important to note that in many cases, both touch and mouse events get sent (in order to let non-touch-specific code still interact with the user). If you use touch events, you should call {{domxref("Event.preventDefault","preventDefault()")}} to keep the mouse event from being sent as well.
The exception to this is Chrome, starting with version 56 (desktop, Chrome for Android, and Android webview), where the default value for the passive option for {{domxref("Element/touchstart_event", "touchstart")}} and {{domxref("Element/touchmove_event", "touchmove")}} is true and calls to {{domxref("Event.preventDefault","preventDefault()")}} will have no effect. To override this behavior, you need to set the passive option to false, after which calling {{domxref("Event.preventDefault","preventDefault()")}} will work as specified. The change to treat listeners as passive by default prevents the listener from blocking page rendering while a user is scrolling. A demo is available on the Chrome Developer site.
See the example on the main Touch events article.
{{Specifications}}
{{Compat}}