Skip to content

Resolve a coordinate target misalignment and event-swallowing bug on …#5157

Merged
diegoteran merged 1 commit into
masterfrom
ar
May 27, 2026
Merged

Resolve a coordinate target misalignment and event-swallowing bug on …#5157
diegoteran merged 1 commit into
masterfrom
ar

Conversation

@diegoteran
Copy link
Copy Markdown
Collaborator

…standard HTML elements when active inside WebXR DOM Overlays. In mobile browsers (such as Chrome on Android), standard tags attempt to open OS-native dialog wheels or bottom sheets. Because these platform-native widgets reside outside the DOM tree, they cannot render correctly over the WebXR context. This results in the element's actual hit-test bounds shifting to the bottom center of the screen, leaving the visual dropdown field unresponsive to direct clicks, while tapping empty space at the bottom triggers the option wheel. To solve this, we created and integrated a standard-compliant, safe, and ultra-lightweight Web Component (custom-select.js) across all scene-graph examples:

  • Renders dropdown option items as custom DOM elements floating entirely within the DOM Overlay hierarchy, avoiding native platform widgets.
  • Safe Event Interception: Catches 'beforexrselect' on the component and triggers 'event.preventDefault()' to block touches from bubbling up as unintended background WebXR 3D scene gesture inputs.
  • High Performance: Leverages standard Shadow DOM elements with a native 'slotchange' listener to dynamically sync light-DOM option children (replacing heavy recursive MutationObservers).
  • Perfect Compatibility: Exposes native getters/setters for '.value', '.selectedIndex', and a native mapped array for the '.options' collection. This allows drop-in slot swaps with zero modifications to existing scripts.
  • Adjusts parent '.controls' container selectors to 'overflow: visible' to let floating option panels display cleanly without clipping.
  • Added an interactive desktop phone simulator page (select-repro.html) that models the touch bound displacement side-by-side with our custom fix. Files Added/Modified:
  • packages/modelviewer.dev/examples/scenegraph/custom-select.js (Added lightweight select component)
  • packages/modelviewer.dev/examples/scenegraph/select-repro.html (Added dual-state visual smartphone simulator)
  • packages/modelviewer.dev/examples/scenegraph/index.html (Integrated custom-select and updated controls overflow styles)

Reference Issue

…standard HTML <select> elements when active inside WebXR DOM Overlays.

In mobile browsers (such as Chrome on Android), standard <select> tags attempt to open OS-native dialog wheels or bottom sheets. Because these platform-native widgets reside outside the DOM tree, they cannot render correctly over the WebXR context. This results in the element's actual hit-test bounds shifting to the bottom center of the screen, leaving the visual dropdown field unresponsive to direct clicks, while tapping empty space at the bottom triggers the option wheel.
To solve this, we created and integrated a standard-compliant, safe, and ultra-lightweight <custom-select> Web Component (custom-select.js) across all scene-graph examples:
- Renders dropdown option items as custom DOM elements floating entirely within the DOM Overlay hierarchy, avoiding native platform widgets.
- Safe Event Interception: Catches 'beforexrselect' on the component and triggers 'event.preventDefault()' to block touches from bubbling up as unintended background WebXR 3D scene gesture inputs.
- High Performance: Leverages standard Shadow DOM <slot> elements with a native 'slotchange' listener to dynamically sync light-DOM option children (replacing heavy recursive MutationObservers).
- Perfect Compatibility: Exposes native getters/setters for '.value', '.selectedIndex', and a native mapped array for the '.options' collection. This allows drop-in slot swaps with zero modifications to existing scripts.
- Adjusts parent '.controls' container selectors to 'overflow: visible' to let floating option panels display cleanly without clipping.
- Added an interactive desktop phone simulator page (select-repro.html) that models the touch bound displacement side-by-side with our custom fix.
Files Added/Modified:
- packages/modelviewer.dev/examples/scenegraph/custom-select.js (Added lightweight select component)
- packages/modelviewer.dev/examples/scenegraph/select-repro.html (Added dual-state visual smartphone simulator)
- packages/modelviewer.dev/examples/scenegraph/index.html (Integrated custom-select and updated controls overflow styles)
@diegoteran diegoteran merged commit 92abad1 into master May 27, 2026
10 checks passed
@diegoteran diegoteran deleted the ar branch May 27, 2026 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant