-
Notifications
You must be signed in to change notification settings - Fork 415
Description
https://immersive-web.github.io/webxr/#list-of-active-xr-input-sources
Each XRSession has a list of active XR input sources (a list of XRInputSource) which MUST be initially an empty list.
This means that if the device already has input sources connected from the start, it needs to immediately fire an inputsourceschange event after the session is created. Threejs relies on this happening.
However, there's a period of time in which the session exists but is not yet available to user code (when the promise hasn't been resolved yet, or the promise has resolved and the resolution microtasks haven't triggered yet). In such a scenario, firing an inputsourceschange event is not useful since nothing can catch it. The current design of the spec seems to have a bit of a pit of failure where codebases can reasonably assume that all input sources will arrive through an inputsourceschange event, but it is technically legal for implementors to fire these events before JS code is practically able to catch it.
I feel like we should either:
- Change the spec wording to allow the input sources list to be non empty at the beginning, and urge framework authors to not make this assumption
- Add spec text that explicitly triggers the add input source algorithm for existing input sources right after the "resolve" line in the
requestSession()algorithm
Servo currently does the former, but that's currently incorrect. Chrome seems to be doing the latter, but it's not explicit, so it might be possible that there's actually a race there.
cc @alcooper91