Merge "Merge branch 'stable-2.14'"
diff --git a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.html b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.html
index 81135ae..c0371ee 100644
--- a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.html
+++ b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.html
@@ -246,7 +246,7 @@
as="file"
initial-count="[[fileListIncrement]]"
target-framerate="1">
- <div class="file-row row" data-path$="[[file.__path]]">
+ <div class="file-row row" data-path$="[[file.__path]]" tabindex="-1">
<div class="reviewed" hidden$="[[!_loggedIn]]" hidden>
<input type="checkbox" checked="[[file.isReviewed]]"
class="reviewed" aria-label="Reviewed checkbox">
@@ -401,6 +401,7 @@
<gr-cursor-manager
id="fileCursor"
scroll-behavior="keep-visible"
+ focus-on-move
cursor-target-class="selected"></gr-cursor-manager>
<gr-reporting id="reporting"></gr-reporting>
</template>
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 7621a9d..0bcd9fd 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 f0f5403..4577a05 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 @@
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 @@
}
});
- suite('_handleEnterKey', () => {
+ suite('_handleOKey', () => {
let interact;
setup(() => {
@@ -402,7 +400,7 @@
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 @@
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 @@
assert.isFalse(element._displayLine);
});
});
+
+ a11ySuite('basic');
</script>
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 1396a2b..fef0f87 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 @@
<td>Select previous file</td>
</tr>
<tr>
- <td><span class="key">Enter</span> or <span class="key">o</span></td>
+ <td><span class="key">o</span></td>
<td>Show selected file</td>
</tr>
<tr>