aframevr / aframe

:a: Web framework for building virtual reality experiences.
https://aframe.io/
MIT License
16.61k stars 3.94k forks source link

Embedded mode scrolls enclosing page when arrow keys are pressed #3958

Open parseccentric opened 5 years ago

parseccentric commented 5 years ago

Description: There is no way to lock arrow key input to go to the A-Frame embedded view without going into fullscreen mode, and as a result, pressing the up/down arrow keys scrolls the page it's embedded in. This is actually evident in the A-Frame website itself.

Here is an example of a workaround you can do if you own the website you are embedding the A-Frame in. It involves checking whether the user has clicked on the body or the a-scene element and "freeing" or "freezing" the scroll accordingly. https://glitch.com/edit/#!/kiwi-magpie

I also had a question about whether the way A-Frame captures keyboard input is compliant with accessibility standards. I don't know enough about the standards to formulate a more specific question though. scratches head

parseccentric commented 5 years ago

Related to this is the fact that embedded view outright refuses to allow the page to scroll whatsoever in Chrome.

dmarcos commented 5 years ago

A-Frame listens to: document.addEventListener('keydown', function() {}, the only way to capture keyboard events in JS. Not sure what accesibility means in this context. You could ignore built-in keyboard input and write your own components to handle input.