Don't capture keys intended for the browser

This is mostly because it was annoying that Cmd-Opt-J didn't work, but seems like a good thing to have in general.
This commit is contained in:
Ray Schamp committed 2016-11-29 10:05:28 -05:00
1 parent be82bddd0c
commit 0bfcd3fed2
1 file changed
+5 -3
+5 -3
View File
@@ -21,9 +21,11 @@ class VMManager {
}
onKeyDown (e) {
// Don't capture keys intended for Blockly inputs.
if (e.target !== document && e.target !== document.body) {
return;
}
if (e.target !== document && e.target !== document.body) return;
// Don't capture browser keyboard shortcuts
if (e.metaKey || e.altKey || e.ctrlKey) return;
this.vm.postIOData('keyboard', {
keyCode: e.keyCode,
isDown: true