Merge "Suppress keyboard shortcuts while some elements are in focus"
This commit is contained in:
commit
93d98113f6
@ -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':
|
||||
|
@ -221,6 +221,8 @@ limitations under the License.
|
||||
},
|
||||
|
||||
_handleKey: function(e) {
|
||||
if (util.shouldSupressKeyboardShortcut(e)) { return; }
|
||||
|
||||
switch(e.detail.combo) {
|
||||
case 'a':
|
||||
this._showReplyField();
|
||||
|
@ -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);
|
||||
|
@ -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';
|
||||
};
|
||||
|
@ -22,6 +22,7 @@ limitations under the License.
|
||||
<script src="../../bower_components/web-component-tester/browser.js"></script>
|
||||
<script src="../../bower_components/page/page.js"></script>
|
||||
<script src="../scripts/fake-app.js"></script>
|
||||
<script src="../scripts/util.js"></script>
|
||||
|
||||
<link rel="import" href="../../bower_components/iron-test-helpers/iron-test-helpers.html">
|
||||
<link rel="import" href="../elements/gr-change-list.html">
|
||||
|
@ -22,6 +22,7 @@ limitations under the License.
|
||||
<script src="../../bower_components/web-component-tester/browser.js"></script>
|
||||
<script src="../../bower_components/page/page.js"></script>
|
||||
<script src="../scripts/changes.js"></script>
|
||||
<script src="../scripts/util.js"></script>
|
||||
|
||||
<link rel="import" href="../../bower_components/iron-test-helpers/iron-test-helpers.html">
|
||||
<link rel="import" href="../elements/gr-change-view.html">
|
||||
|
Loading…
Reference in New Issue
Block a user