0

Trying to get event handling correct for a web app that should work equally well with mouse and touch events, I started using pointer events where mouse and touch handling should be basically the same. Yet this sometimes interferes in weird ways with default bindings. To better understand how to correctly avoid this I have the following

Question: can anyone point to a write-up or spec describing things like:

  • in which order do we get pointer, mouse, touch events for the same user interaction on devices which support them
  • is there a way to tell for, say, a pointer and a mouse event that they originate from the same user interaction
  • will same-user-interaction events bubble interleaved or one after the other

Alternatively I am happy to get write-ups here. Maybe the whole relation between those events and how they are (typically) handled can be described more concise than I assume.

1 Answer 1

-1

Touch Events W3C recommendation were introduced by Apple with the release of iOS 2.0 in 2008. Touch events translate touch screen input (and only touch screen input) to events similar to the traditional mouse events (touchstart=mousedown, touchend=mouseup).

Pointer Events W3C recommendation encapsulate a whole bunch of input methods in one single layer of abstraction. Mouse, touch and pen input are all translated to one common “pointer” event the application can react to.

Pointer events are not supported by all browsers, see this.

Sign up to request clarification or add additional context in comments.

1 Comment

The linked article about supported browsers is out-of-date (looks like it was out-of-date when posted, too?). Suggest to use something that is likely to be updated, like: caniuse.com/?search=pointerevents

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.