-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTMLMesh: hover on button elements in VR #25927
Labels
Milestone
Comments
Oh, that's annoying... |
FYI, I had same needs in my https://www.metalograms.com/demo/ project and I also adds .hover class on items listening to mouse events when mouse is really hover. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
Style :hover on button elements doesn't work in VR. That's because
window.getComputedStyle( element )
doesn't get updated once you are in a immersive-vr session.Solution
Save the hover styles before entering VR, so we can apply the correct style on mouseenter/mouseleave by adding a hover class on the button.
For this to work, you need to have some css rules like that :
Alternatives
You can modify on the fly all the loaded stylesheets to add the
button.hover
variant like it has been done on other aframe ui components, but I find that very intrusive.Additional context
I create this issue for visibility. I did some months ago a PR on aframe-htmlmesh AdaRoseCannon/aframe-htmlmesh#9 to implement this. This works great, but could be generalized to other elements than button, and use something different than using data attributes to keep a list of css properties with their value. I'm not planning to work on it right now. If you have suggestions, you can comment on the PR.
The text was updated successfully, but these errors were encountered: