Closed jsantell closed 7 years ago
Using the method described in #406 -- any issues you think with this approach? Or any input field areas that aren't accounted for? Works best alongside #407 so that hotkeys are also usable when selecting the first entity
What about, instead of including stopPropagating
on every possible input control, modify the code for shouldCaptureKeyEvent
for the inspector?
Something like:
function shouldCaptureKeyEvent(event) {
if (event.metaKey) { return false; }
return document.activeElement === document.body &&
(event.target.tagName !== 'INPUT' ||
event.target.tagName !== 'TEXTAREA');
}
@fernandojsg That would work as well! My only concern would be interactions like arrow keys moving the camera around when the Entities panel has focus (would scroll the panel instead), but seems like a separate issue of handling focus (and not sure which behaviour is even preferred!) -- all in all, I think the solution of checking for origin of the event and canceling on input elements would be the smallest change for now!
That being said, I believe document.activeElement === document.body
is the part that is currently preventing shortcuts from occuring when the entities panel has focus, as the SceneGraph's .outliner div steals focus
Pushed a change based on feedback
Cool! thank you
input elements from propagating events to document if they should not be acted on. Fixes #406