diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
index 7ad5521..7945908 100644
--- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
@@ -154,8 +154,7 @@
                 }
                 break;
             case MSG_TYPING_STATE_EXPIRED:
-                cancelAndStartAnimators(keyboardView.mAltCodeKeyWhileTypingFadeoutAnimator,
-                        keyboardView.mAltCodeKeyWhileTypingFadeinAnimator);
+                startWhileTypingFadeinAnimation(keyboardView);
                 break;
             }
         }
@@ -229,7 +228,7 @@
             removeMessages(MSG_LONGPRESS_KEY);
         }
 
-        public static void cancelAndStartAnimators(final ObjectAnimator animatorToCancel,
+        private static void cancelAndStartAnimators(final ObjectAnimator animatorToCancel,
                 final ObjectAnimator animatorToStart) {
             float startFraction = 0.0f;
             if (animatorToCancel.isStarted()) {
@@ -241,18 +240,39 @@
             animatorToStart.setCurrentPlayTime(startTime);
         }
 
+        private static void startWhileTypingFadeinAnimation(final MainKeyboardView keyboardView) {
+            cancelAndStartAnimators(keyboardView.mAltCodeKeyWhileTypingFadeoutAnimator,
+                    keyboardView.mAltCodeKeyWhileTypingFadeinAnimator);
+        }
+
+        private static void startWhileTypingFadeoutAnimation(final MainKeyboardView keyboardView) {
+            cancelAndStartAnimators(keyboardView.mAltCodeKeyWhileTypingFadeinAnimator,
+                    keyboardView.mAltCodeKeyWhileTypingFadeoutAnimator);
+        }
+
         @Override
-        public void startTypingStateTimer() {
+        public void startTypingStateTimer(Key typedKey) {
+            if (typedKey.isModifier() || typedKey.altCodeWhileTyping()) {
+                return;
+            }
+
             final boolean isTyping = isTypingState();
             removeMessages(MSG_TYPING_STATE_EXPIRED);
+            final MainKeyboardView keyboardView = getOuterInstance();
+
+            // When user hits the space or the enter key, just cancel the while-typing timer.
+            final int typedCode = typedKey.mCode;
+            if (typedCode == Keyboard.CODE_SPACE || typedCode == Keyboard.CODE_ENTER) {
+                startWhileTypingFadeinAnimation(keyboardView);
+                return;
+            }
+
             sendMessageDelayed(
                     obtainMessage(MSG_TYPING_STATE_EXPIRED), mParams.mIgnoreAltCodeKeyTimeout);
             if (isTyping) {
                 return;
             }
-            final MainKeyboardView keyboardView = getOuterInstance();
-            cancelAndStartAnimators(keyboardView.mAltCodeKeyWhileTypingFadeinAnimator,
-                    keyboardView.mAltCodeKeyWhileTypingFadeoutAnimator);
+            startWhileTypingFadeoutAnimation(keyboardView);
         }
 
         @Override
diff --git a/java/src/com/android/inputmethod/keyboard/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
index bd89651..0a284cc 100644
--- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java
+++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
@@ -82,7 +82,7 @@
     }
 
     public interface TimerProxy {
-        public void startTypingStateTimer();
+        public void startTypingStateTimer(Key typedKey);
         public boolean isTypingState();
         public void startKeyRepeatTimer(PointerTracker tracker);
         public void startLongPressTimer(PointerTracker tracker);
@@ -95,7 +95,7 @@
 
         public static class Adapter implements TimerProxy {
             @Override
-            public void startTypingStateTimer() {}
+            public void startTypingStateTimer(Key typedKey) {}
             @Override
             public boolean isTypingState() { return false; }
             @Override
@@ -329,9 +329,7 @@
             mListener.onPressKey(key.mCode);
             final boolean keyboardLayoutHasBeenChanged = mKeyboardLayoutHasBeenChanged;
             mKeyboardLayoutHasBeenChanged = false;
-            if (!key.altCodeWhileTyping() && !key.isModifier()) {
-                mTimerProxy.startTypingStateTimer();
-            }
+            mTimerProxy.startTypingStateTimer(key);
             return keyboardLayoutHasBeenChanged;
         }
         return false;
@@ -956,9 +954,7 @@
     public void onRegisterKey(Key key) {
         if (key != null) {
             detectAndSendKey(key, key.mX, key.mY);
-            if (!key.altCodeWhileTyping() && !key.isModifier()) {
-                mTimerProxy.startTypingStateTimer();
-            }
+            mTimerProxy.startTypingStateTimer(key);
         }
     }
 
