Using WASD controls not working when scene is embedded (and body isn't the document.activeElement)
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 17.6k
- Forks
- 4.4k
- PR merge metrics
- No merged PRs in 30d
Description
Description:
The scene is embedded inside a bootstrap modal dialog and the shouldCaptureKeyEvent method ( https://github.com/aframevr/aframe/blob/master/src/utils/index.js#L176 ) returns false because, in my case document.activeElement is the modal dialog div which does not equal to the document.body.
return document.activeElement === document.body;
What is the reason for this statement?
- A-Frame Version: 0.4.0
- Platform / Device: Chrome, Firefox
- Reproducible Code Snippet or URL:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The relevant entry point is shouldCaptureKeyEvent in src/utils/index.js around line 176; first inspect why it requires document.activeElement to be document.body and reproduce the Bootstrap modal case in Chrome or Firefox. Done means agreeing on the intended focus behavior for embedded scenes and verifying that WASD input works without capturing keystrokes intended for the modal.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100