Repository: three.js
Issue: XR: session events are incorrect or missing when using immersive-ar and multitouch
Labels: Needs Investigation

<!-- Ignoring this template may result in your bug report getting deleted -->

**Describe the bug**

It seems that something inside three's immersive session handling messes with the events that would be expected from the immersive session. In particular, when trying to use multitouch during an AR session, the expected order of events is

but when using threejs the order of events is

(only the first finger produces a selectstart and subsequent select and selectend events, but all fingers produce inputdevicechange events as expected).

To verify that this must indeed be a three issue and not a Chrome / immersive session bug, I reproduced this in both three and vanilla WebXR; vanilla WebXR has the expected order of events but three somehow "eats" the expected multitouch events from all but the first finger.

**To Reproduce**

Steps to reproduce the incorrect behavior (when using threejs):
1. connect Android phone to chrome://inspect
2. open on phone https://shine-jumpy-bass.glitch.me/ (to see the code go to https://glitch.com/edit/#!/shine-jumpy-bass)
3. open the page via chrome://inspect so you see logs
4. put one finger on the screen (keep it) - note "inputdevicechange" and "selectstart" events
5. lift finger - note "select", "selectend", "inputdevicechange"
6. put one finger down again
7. put second finger down - note only "inputdevicechange" (expected would be "selectstart")
8. lift one finger - note only "inputdevicechange" (expected would be "select" and "selectend")
9. lift last finger - note "select", "selectend", "inputdevicechange"
10. try with more fingers, all but the first will only send "inputdevicechange"

Note that the first placed finger will send correct events, independent of the order of lifting fingers again.

![image](https://user-images.githubusercontent.com/2693840/155440244-782b7c07-e9de-4ccb-be17-c6308a5cb351.png)

Steps to reproduce the expected behavior (when using vanilla WebXR):
1. connect Android phone to chrome://inspect
2. open on phone https://xr-session-multitouch-crbug.glitch.me/ (to see the code go to https://glitch.com/edit/#!/xr-session-multitouch-crbug)
3. open the page via chrome://inspect so you see logs
4. put one finger on the screen (keep it) - note "inputdevicechange" and "selectstart" events
5. lift finger - note "select", "selectend", "inputdevicechange"
6. put one finger down again
7. put second finger down - note same order, "inputdevicechange" followed by "selectstart"
8. lift one finger - note "select", "selectend", "inputdevicechange"
9. lift last finger - note "select", "selectend", "inputdevicechange"

***Code***
Note that this _should_ directly access the underlaying WebXR session and behaviour should be identical between threejs and vanilla WebXR. It seems that something in three is interfering with event delivery here? Maybe a silent exception? Not sure how this could happen...

```js
        session.addEventListener( 'select', onSessionEvent ); // not sent for all but the first planted finger
        session.addEventListener( 'selectstart', onSessionEvent ); // not sent for all but the first planted finger
        session.addEventListener( 'selectend', onSessionEvent ); // not sent for all but the first planted finger
        session.addEventListener( 'inputsourceschange', onInputSourcesChange ); // sent for all fingers
       
...

      function onSessionEvent(event) {
          console.log("session event", event);
      }
      
      function onInputSourcesChange( event ) {
         console.log("input sources change", event); 
      }
```

***Live example***

* Incorrect events (threejs): https://shine-jumpy-bass.glitch.me/ (to see the code go to https://glitch.com/edit/#!/shine-jumpy-bass)
* Works as expected (vanilla WebXR): https://xr-session-multitouch-crbug.glitch.me/ (to see the code go to https://glitch.com/edit/#!/xr-session-multitouch-crbug)

**Expected behavior**

Correct event order from controller events in threejs.

**Platform:**

 - Device: [Mobile]
 - OS: [Android]
 - Browser: [Chrome, Firefox]