aframevr / aframe

:a: Web framework for building virtual reality experiences.
https://aframe.io/
MIT License
16.72k stars 3.99k forks source link

Change in positioning of canvas DOM element in 0.7.0 broke compatibility with Elm #3460

Closed nmsmith closed 5 years ago

nmsmith commented 6 years ago

In A-Frame 0.6.1, DOM elements that are generated by A-Frame when the initial HTML is read are added as the last children of the a-scene element. Since 0.7.0, the canvas is added as the first child of the a-scene element. This breaks Elm's virtual DOM diffing algorithm which expects the indices of elements that it generates to remain the same every time it does a diff. Having a canvas element spontaneously appear as the first child shifts the indices of the other children by 1.

The canvas element position was changed in commit https://github.com/aframevr/aframe/commit/412d16203791e62cd7b7d51fce3309a40c6fb8b7.

There is no simple solution to resolve this on the Elm side but if the canvas element is put back at the end of the list of a-scene children then A-Frame will once again be usable with Elm. The declarative style of A-Frame works really well with the Elm Architecture so it would be a shame to let this minor issue prevent the Elm community from working with it.

ngokevin commented 5 years ago

I'm going to leave this as an issue for Elm to work around. I don't recommend throwing in unrelated third-party frameworks for this reason.