Does A-Frame manage ARIA roles and keyboard focus across 2D and WebXR immersive modes?
0 reputation · 11 Sept 2022, 15:55 UTC
0 reputation · 11 Sept 2022, 15:55 UTC
Goal: Determine whether A-Frame exposes ARIA roles and preserves keyboard focus for <a-entity> elements when a scene switches between standard 2D rendering and WebXR immersive mode.
A-Frame renders entities through three.js into a WebGL canvas, so 3D objects are not automatically exposed as accessible DOM nodes.
The framework provides cursor and raycaster interaction components but publishes no default ARIA role mapping for entities.
Entering immersive VR can pointer-lock or hide the 2D overlay, and it is unclear whether focus is retained, redirected, or lost during and after the WebXR session.
Screen-reader and WebXR behavior also varies by browser and operating system, and ARIA placed on an <a-entity> does not necessarily make the rendered object keyboard-focusable inside the scene.
Assuming a current A-Frame release, does the framework document any focus-management pattern spanning 2D and immersive views, or must developers implement ARIA attributes and focus restoration manually?
Which elements, if any, remain in the accessibility tree while WebXR is active?
36775 reputation · 11 Sept 2022, 22:17 UTC
No. A-Frame does not provide built-in ARIA role mapping for <a-entity> elements, nor does it manage keyboard focus when a scene switches between standard 2D rendering and WebXR immersive mode. Developers must add ARIA attributes manually and restore focus themselves after entering or exiting immersive VR.
A-Frame renders entities through three.js into a WebGL canvas. The canvas is a single bitmap to the browser, so individual 3D objects are not exposed as accessible DOM nodes. Placing aria-label, role, or tabindex on an <a-entity> may keep that element in the DOM accessibility tree, but it does not make the rendered object keyboard-focusable inside the scene.
Entering WebXR can pointer-lock the canvas or hide the 2D overlay. A-Frame does not guarantee that document.activeElement is preserved, redirected, or restored when the XR session ends. Cursor and raycaster components handle 3D interaction, not keyboard focus or accessibility roles.
| Element | 2D mode | WebXR immersive active |
|---|---|---|
<a-scene> WebGL canvas | Canvas container present; no per-entity ARIA nodes | Still present, but pointer-locked or overlay-hidden; no automatic focus management |
| Visible HTML overlay outside canvas | In accessibility tree if not hidden or inert | Remains in tree only if visible and not inert; browser and runtime behavior varies |
<a-entity> with ARIA attributes | May appear in DOM accessibility tree | Same DOM presence, but not a focusable 3D object; announcement depends on assistive technology |
<a-entity> elements.<a-scene> to save and restore document.activeElement or move focus to a designated element.Assumptions and uncertainty: This answer assumes a current A-Frame release and standard WebXR support in the host browser. Exact behavior can differ by browser, operating system, screen reader, and WebXR runtime. ARIA on <a-entity> is not a substitute for a screen-reader-friendly representation of a 3D object.
Missing diagnostic detail: Which browser, operating system, and screen-reader combination do you need to support? That determines whether a manual focus polyfill or a different overlay strategy is required.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.