Re: [w3c/touch-events] note about avoiding conditional "touch OR mouse/keyboard" event handling (#72)

> +// conditional "touch OR mouse/keyboard" event binding
> +if ('ontouchstart' in window) {
> +  // set up event listeners for touch
> +} else {
> +  // set up event listeners for mouse/keyboard
> +}
> +</code></pre>
> +      <p>Instead, developers should handle different forms of input concurrently.</p>
> +<pre class="example"><code>
> +// concurrent "touch AND mouse/keyboard" event binding
> +if ('ontouchstart' in window) {
> +  // set up event listeners for touch
> +}
> +// set up event listeners for mouse/keyboard
> +</code></pre>      
> +      <p>To avoid processing the same interaction twice for touch (once for the touch event, and once for the compatibility mouse events), developers should make sure to <a href="#dfn-canceled-event">cancel</a> the touch event, suppressing the generation of any further mouse or click events. Alternatively, see the <a href="http://wicg.github.io/InputDeviceCapabilities/">InputDeviceCapabilities API</a> for a way to detect mouse events that were generated as a result of touch events.</p>

Nice!

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/touch-events/pull/72/files/9faf80b27d03bdc65847bfb82bc851ebc203f3e6#r73158781

Received on Tuesday, 2 August 2016 14:09:34 UTC