fix(xr): move Enter XR into View menu, drop iwer overlay#173
Merged
Conversation
The floating Enter XR pill on desktop was actually @pmndrs/xr's bundled iwer device emulator, which auto-injects on localhost via the default `emulate: 'metaQuest3'`. It overlapped the toolbar and looked like ours. - Disable the iwer emulator (`emulate: false`) on the shared xrStore so no DOM button is injected. - Move XR entry/exit into the View menu as Enter VR / Enter AR / Exit XR, parallelling the RayTracingSubmenu pattern. Always rendered; disabled when the browser's `navigator.xr.isSessionSupported` says the mode is unavailable, so users can see the capability exists. - Drop the now-orphan EnterXRButton.tsx + its Viewport overlay slot. Side fix: the previous floating button used `useXR()` from @react-three/xr, which only works inside the <XR> provider tree — that's the "XR features can only be used inside the <XR> component" error desktop users were hitting. The new menu component reads from the support store + `useXRPresenting` hook, both safe outside the tree.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
emulate: 'metaQuest3'. Disabled it (emulate: false) on the sharedxrStore.Enter VR/Enter AR/Exit XR, paralleling theRayTracingSubmenupattern. Always rendered; disabled when the browser reports the mode unsupported, so users can see the capability exists.EnterXRButton.tsx+ its Viewport overlay slot.Why
Desktop users hit
XR features can only be used inside the <XR> componentbecause the previous floatingEnterXRButtoncalleduseXR()from@react-three/xrwhile rendered in a DOM overlay outside the<XR>provider tree. The new menu component reads fromuseXRSupportStore+useXRPresenting(both safe outside the tree), and lives in the same DOM hierarchy as the rest of the menubar.Test plan
Enter VRandEnter ARgrayed out.useXRSupportStore.setState({ vr: true, ar: true, checked: true })+ skip module-loadrefresh()): both items render enabled and clickable in the View menu.Exit XRshould appear while presenting.