This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The beforexrselect event is fired before WebXR select events (select, selectstart, selectend) are dispatched. It can be used to suppress XR world input events while the user is interacting with a DOM overlay UI.
This event bubbles, is cancelable and is composed.
Use the event name in methods like addEventListener(), or set an event handler property.
addEventListener("beforexrselect", (event) => { })
onbeforexrselect = (event) => { }
An XRSessionEvent. Inherits from Event.
The beforexrselect event is a global event and available to the following interfaces:
To suppress WebXR select events (select, selectstart, selectend), an application can listen for the beforexrselect event. The event bubbles, so a call to preventDefault() on the DOM overlay element will prevent any WebXR select events within this container allowing interaction with the DOM element and avoiding duplicate event input to the XR world.
document
.getElementById("xr-overlay")
.addEventListener("beforexrselect", (ev) => ev.preventDefault());
| Specification |
|---|
| WebXR DOM Overlays Module> # onbeforexrselect> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
beforexrselect_event |
83 | 83 | No | 69 | No | 83 | No | 59 | No | 13.0 | No | No |
select eventselectstart eventselectend event
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Element/beforexrselect_event