Ignore board movement when user edit input.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Wed, 10 Sep 2014 17:33:04 +0300
changeset 37 fe75d168a605
parent 36 a18fc2601ce8
child 38 d476efde7242
Ignore board movement when user edit input.
2048.html
--- a/2048.html	Wed Sep 10 14:49:28 2014 +0300
+++ b/2048.html	Wed Sep 10 17:33:04 2014 +0300
@@ -382,6 +382,8 @@
     document.getElementById("right").addEventListener("click", ui.action.right);
 
     document.body.addEventListener("keydown", function(event) {
+      if (document.activeElement.value)
+        return false;
       var key = event.keyCode || event.which;
       switch (key) {
           case 38: ui.action.up(); break;