InputDeviceCapabilities: firesTouchEvents property
Experimental:This is anexperimental technology
Check theBrowser compatibility table carefully before using this in production.
ThefiresTouchEvents
read-only property of theInputDeviceCapabilities
interface returns a boolean value that indicates whether the device dispatches touch events.
You can use this property to detect mouse events that represent an action that mayalready have been handled by touch event handlers. This doesn't necessarily mean thedevice is a touch screen. For example, stylus and mouse devices typically generatetouch events on mobile browsers.
In this article
Value
Example
js
myButton.addEventListener("mousedown", (e) => { if (!e.sourceCapabilities.firesTouchEvents) myButton.classList.add("pressed");});
Specifications
Specification |
---|
Input Device Capabilities> # dom-inputdevicecapabilities-firestouchevents> |
Browser compatibility
Loading…