Add go key as a modifier check

When processing keyboard combos, we check if the existing go key
was pressed as a modifier.
This fixes the bug where pressing `g + i` resulted in the listener
for `i` being called. The bug was not visible since we always
navigated to a different page after pressing the go key.
Each component using the behaviour now listens for the go key.

Change-Id: I9d1c3c32b4512ee702cea4a3e46cdfb110fa6bfd
diff --git a/polygerrit-ui/app/behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior.js b/polygerrit-ui/app/behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior.js
index ca31ee8..49f27bc 100644
--- a/polygerrit-ui/app/behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior.js
+++ b/polygerrit-ui/app/behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior.js
@@ -507,7 +507,8 @@
 
     modifierPressed(e) {
       e = getKeyboardEvent(e);
-      return e.altKey || e.ctrlKey || e.metaKey || e.shiftKey;
+      return e.altKey || e.ctrlKey || e.metaKey || e.shiftKey ||
+        !!this._inGoKeyMode();
     },
 
     isModifierPressed(e, modifier) {
@@ -580,11 +581,14 @@
         this._addOwnKeyBindings(key, shortcuts[key]);
       }
 
+      // each component that uses this behaviour must be aware if go key is
+      // pressed or not, since it needs to check it as a modifier
+      this.addOwnKeyBinding('g:keydown', '_handleGoKeyDown');
+      this.addOwnKeyBinding('g:keyup', '_handleGoKeyUp');
+
       // If any of the shortcuts utilized GO_KEY, then they are handled
       // directly by this behavior.
       if (this._shortcut_go_table.size > 0) {
-        this.addOwnKeyBinding('g:keydown', '_handleGoKeyDown');
-        this.addOwnKeyBinding('g:keyup', '_handleGoKeyUp');
         this._shortcut_go_table.forEach((handler, key) => {
           this.addOwnKeyBinding(key, '_handleGoAction');
         });
@@ -611,12 +615,15 @@
     },
 
     _handleGoKeyDown(e) {
-      if (this.modifierPressed(e)) { return; }
       this._shortcut_go_key_last_pressed = Date.now();
     },
 
     _handleGoKeyUp(e) {
-      this._shortcut_go_key_last_pressed = null;
+      // Set go_key_last_pressed to null `GO_KEY_TIMEOUT_MS` after keyup event
+      // so that users can trigger `g + i` by pressing g and i quickly.
+      setTimeout(() => {
+        this._shortcut_go_key_last_pressed = null;
+      }, GO_KEY_TIMEOUT_MS);
     },
 
     _inGoKeyMode() {