diff --git a/polygerrit-ui/app/elements/gr-change-list.html b/polygerrit-ui/app/elements/gr-change-list.html index a1fd952482..241e8b0407 100644 --- a/polygerrit-ui/app/elements/gr-change-list.html +++ b/polygerrit-ui/app/elements/gr-change-list.html @@ -84,6 +84,8 @@ limitations under the License. }, _handleKey: function(e) { + if (util.shouldSupressKeyboardShortcut(e)) { return; } + var len = (this.changes && this.changes.length) || 0; switch(e.detail.combo) { case 'j': diff --git a/polygerrit-ui/app/elements/gr-change-view.html b/polygerrit-ui/app/elements/gr-change-view.html index b2bc133f01..afadaeee10 100644 --- a/polygerrit-ui/app/elements/gr-change-view.html +++ b/polygerrit-ui/app/elements/gr-change-view.html @@ -221,6 +221,8 @@ limitations under the License. }, _handleKey: function(e) { + if (util.shouldSupressKeyboardShortcut(e)) { return; } + switch(e.detail.combo) { case 'a': this._showReplyField(); diff --git a/polygerrit-ui/app/elements/gr-diff-view.html b/polygerrit-ui/app/elements/gr-diff-view.html index 87d4a9942d..c3654d199d 100644 --- a/polygerrit-ui/app/elements/gr-diff-view.html +++ b/polygerrit-ui/app/elements/gr-diff-view.html @@ -314,6 +314,8 @@ limitations under the License. }, _handleKey: function(e) { + if (util.shouldSupressKeyboardShortcut(e)) { return; } + switch(e.detail.combo) { case '[': this._navToFile(this._fileList, -1); diff --git a/polygerrit-ui/app/scripts/util.js b/polygerrit-ui/app/scripts/util.js index 400ed8667f..2f5ecafd05 100644 --- a/polygerrit-ui/app/scripts/util.js +++ b/polygerrit-ui/app/scripts/util.js @@ -38,3 +38,12 @@ util.escapeHTML = function(str) { return util.htmlEntityMap[s]; }); }; + +util.shouldSupressKeyboardShortcut = function(e) { + var target = e.detail.keyboardEvent.target; + return target.tagName == 'INPUT' || + target.tagName == 'TEXTAREA' || + target.tagName == 'SELECT' || + target.tagName == 'BUTTON' || + target.tagName == 'A'; +}; diff --git a/polygerrit-ui/app/test/gr-change-list-test.html b/polygerrit-ui/app/test/gr-change-list-test.html index 01b297cb86..afbd32ac87 100644 --- a/polygerrit-ui/app/test/gr-change-list-test.html +++ b/polygerrit-ui/app/test/gr-change-list-test.html @@ -22,6 +22,7 @@ limitations under the License. + diff --git a/polygerrit-ui/app/test/gr-change-view-test.html b/polygerrit-ui/app/test/gr-change-view-test.html index c016c6a551..3e332bf74c 100644 --- a/polygerrit-ui/app/test/gr-change-view-test.html +++ b/polygerrit-ui/app/test/gr-change-view-test.html @@ -22,6 +22,7 @@ limitations under the License. +