Search code examples
aframe

Why does a-frame add 'a-html' class to my html element?


This is my first foray using a-frame, and I'm setting up a simple a-frame to display an .obj file in my application. It's nothing crazy and I got it working without too much effort from an example. The catch is that including the a-frame code will add a class to my root "html" element called "a-html" that breaks a lot of my stylings. I can understand if they include that class in their stylings they include with their resources and it goes unused, but why would it presumptively add a class on an element it shouldn't need to touch?

My code so far:

<script src="https://aframe.io/releases/0.8.2/aframe.min.js"></script>
<script src="https://unpkg.com/aframe-orbit-controls@1.0.0/dist/aframe-orbit-controls.min.js"></script>
<script src="https://unpkg.com/aframe-supercraft-loader@1.1.3/dist/aframe-supercraft-loader.js"></script>

...

<button type="button" class="btn btn-default" data-toggle="modal" data-target="#3d-model-modal">View 3D model</button>

<div id="3d-model-modal" class="modal fade" role="dialog" >
    <div class="modal-dialog" style="width:900px; height: 900px">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title"></h4>
            </div>
            <div class="modal-body">
                <div id="obj-container">
                    <a-scene vr-mode-ui="enabled: false">
                        <a-assets>
                            <a-asset-item id="model-obj" src="<c:url value="/customerStatus/getObjFile/${guid}" />" ></a-asset-item>
                            <a-asset-item id="textures" src="<c:url value="/customerStatus/getMtlFile" />"></a-asset-item>
                        </a-assets>

                        <a-entity obj-model="obj: #model-obj; mtl: #textures"  rotation="-90 0 0"></a-entity>
                        <a-entity camera look-controls orbit-controls="target: 0 1.6 -0.5; minDistance: 0.5; maxDistance: 180; initialPosition: 0 15 25"></a-entity>
                        <a-plane position="0 0 -10" rotation="-90 0 0" width="4000" height="4000" color="#526F35"></a-plane>
                        <a-sky color="#87CEEB"></a-sky>
                    </a-scene>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>

Solution

  • It's for full screen stylings and prevention of page overflow / scrolling by default. Can either toggle the style rules off with <a-scene embedded="true">, or override the stylings, or remove the class.

    See the A-frame docs for more details: https://aframe.io/docs/0.8.0/components/embedded.html