You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"<a href='../examples/loading/#dracoSupport'>Details on setting static properties</a>"
126
126
]
127
+
},
128
+
{
129
+
"name": "How do I make custom inputs or overlays work reliably in AR DOM Overlay mode?",
130
+
"htmlName": "ar-dom-overlay-inputs",
131
+
"description": "Inside a WebXR full-screen immersive AR session, mobile browsers do not shrink the layout viewport when a soft keyboard is shown, which can cover your custom input overlays. Additionally, tap events on your overlays can propagate as WebXR screen taps and trigger unexpected 3D gestures (like model movements). To prevent these issues, follow two best practices:<br/><br/>1. <b>Event Suppression:</b> The core <model-viewer> now automatically intercepts the <code>beforexrselect</code> event on your interactive DOM elements and calls <code>event.preventDefault()</code> to stop WebXR from turning DOM taps into 3D session interactions.<br/>2. <b>Viewport Resizing:</b> Use the <code>visualViewport</code> API to listen for keyboard height overlays (when <code>ar-status='session-started'</code>) and translate your elements upward (e.g., via <code>transform: translateY(-offset px);</code>) to keep them visible above the keyboard, as demonstrated in our scenegraph example.",
will be generated on the fly from the current state.
158
158
</p>
159
159
<p><b>Tip:</b> When building custom interactive overlay controls with text or numeric input fields on mobile, ensure your inputs are styled with a CSS rule setting <code>font-size: 16px;</code> (or larger). If a focused text field's computed font size is below 16px, mobile WebKit browsers (like iOS Safari and Chrome) will automatically zoom in the entire viewport, which does not automatically reset when the input is blurred and can break the page layout.</p>
160
+
<p><b>AR Keyboard Overlays:</b> Inside a WebXR full-screen immersive AR session, mobile browsers do not shrink the layout viewport when a software virtual keyboard is open. To prevent inputs from being covered by the keyboard, you can register a <code>visualViewport</code> resize listener (only active when <code>ar-status="session-started"</code>) to calculate the soft keyboard's overlay height and dynamically translate your overlay container upward (e.g., via <code>transform: translateY(-offset px);</code>), as demonstrated in the script below.</p>
0 commit comments