Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
don't capture keys if a field is active or
  • Loading branch information
rpendleton committed Feb 5, 2019
1 parent 901e9fb commit 60892af
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion neural_nets.js
Expand Up @@ -841,7 +841,10 @@ function Sim() {

window.addEventListener('keydown', (function(e) {
var num;
if (e.key === 's') {

if (document.activeElement !== document.body || e.metaKey) {
// do nothing in case the text field is focused or the user is holding a modifier
} else if (e.key === 's') {
// step hotkey
this.step();
e.preventDefault();
Expand Down

0 comments on commit 60892af

Please sign in to comment.