@@ -401,6 +401,7 @@ limitations under the License.
diff --git a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js
index 7621a9d9c3..0bcd9fd558 100644
--- a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js
+++ b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js
@@ -135,7 +135,7 @@
'c': '_handleCKey',
'[': '_handleLeftBracketKey',
']': '_handleRightBracketKey',
- 'o enter': '_handleEnterKey',
+ 'o': '_handleOKey',
'n': '_handleNKey',
'p': '_handlePKey',
'shift+a': '_handleCapitalAKey',
@@ -537,14 +537,10 @@
this._openSelectedFile(0);
},
- _handleEnterKey(e) {
+ _handleOKey(e) {
if (this.shouldSuppressKeyboardShortcut(e) ||
this.modifierPressed(e)) { return; }
- // Use native handling if an anchor is selected. @see Issue 5754
- if (e.detail && e.detail.keyboardEvent && e.detail.keyboardEvent.target &&
- e.detail.keyboardEvent.target.tagName === 'A') { return; }
-
e.preventDefault();
if (this._showInlineDiffs) {
this._openCursorFile();
diff --git a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_test.html b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_test.html
index f0f5403422..4577a05d10 100644
--- a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_test.html
+++ b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list_test.html
@@ -331,9 +331,7 @@ limitations under the License.
const showStub = sandbox.stub(page, 'show');
assert.equal(element.$.fileCursor.index, 2);
assert.equal(element.selectedIndex, 2);
- MockInteractions.pressAndReleaseKeyOn(element, 13, null, 'enter');
- assert(showStub.lastCall.calledWith('/c/42/2/myfile.txt'),
- 'Should navigate to /c/42/2/myfile.txt');
+
// k with a modifier should not move the cursor.
MockInteractions.pressAndReleaseKeyOn(element, 75, 'shift', 'k');
assert.equal(element.$.fileCursor.index, 2);
@@ -384,7 +382,7 @@ limitations under the License.
}
});
- suite('_handleEnterKey', () => {
+ suite('_handleOKey', () => {
let interact;
setup(() => {
@@ -402,7 +400,7 @@ limitations under the License.
const e = new CustomEvent('fake-keyboard-event', opt_payload);
sinon.stub(e, 'preventDefault');
- element._handleEnterKey(e);
+ element._handleOKey(e);
assert.isTrue(e.preventDefault.called);
const result = {};
if (openCursorStub.called) {
@@ -440,14 +438,6 @@ limitations under the License.
element._userPrefs.expand_inline_diffs = true;
assert.deepEqual(interact(), {expanded: true});
});
-
- test('noop when anchor focused', () => {
- const e = new CustomEvent('fake-keyboard-event',
- {detail: {keyboardEvent: {target: document.createElement('a')}}});
- sinon.stub(e, 'preventDefault');
- element._handleEnterKey(e);
- assert.isFalse(e.preventDefault.called);
- });
});
});
@@ -1242,4 +1232,6 @@ limitations under the License.
assert.isFalse(element._displayLine);
});
});
+
+ a11ySuite('basic');
diff --git a/polygerrit-ui/app/elements/core/gr-keyboard-shortcuts-dialog/gr-keyboard-shortcuts-dialog.html b/polygerrit-ui/app/elements/core/gr-keyboard-shortcuts-dialog/gr-keyboard-shortcuts-dialog.html
index 1396a2b344..fef0f87c19 100644
--- a/polygerrit-ui/app/elements/core/gr-keyboard-shortcuts-dialog/gr-keyboard-shortcuts-dialog.html
+++ b/polygerrit-ui/app/elements/core/gr-keyboard-shortcuts-dialog/gr-keyboard-shortcuts-dialog.html
@@ -231,7 +231,7 @@ limitations under the License.
Select previous file |
- Enter or o |
+ o |
Show selected file |