Don't curse over files with up/down keys
Previously, if up/down keys were pressed, and the cursor was to move
over files rather than the diff rows, the file list cursor would move up
or down. Because this interfered with the browser's native scrolling
with up/down keys, that behavior has been removed. The j/k keys still
work as they did before.
Bug: Issue 7815
Change-Id: Iaf031f845293a3605a88a9e656eb000b0e4e196f
(cherry picked from commit 7b550ef34b)
This commit is contained in:
committed by
Paladox none
parent
042ead2a5e
commit
83dccdf008
@@ -510,11 +510,14 @@
|
||||
return;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
if (this._showInlineDiffs) {
|
||||
e.preventDefault();
|
||||
this.$.diffCursor.moveDown();
|
||||
this._displayLine = true;
|
||||
} else {
|
||||
// Down key
|
||||
if (this.getKeyboardEvent(e).keyCode === 40) { return; }
|
||||
e.preventDefault();
|
||||
this.$.fileCursor.next();
|
||||
this.selectedIndex = this.$.fileCursor.index;
|
||||
}
|
||||
@@ -525,11 +528,14 @@
|
||||
return;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
if (this._showInlineDiffs) {
|
||||
e.preventDefault();
|
||||
this.$.diffCursor.moveUp();
|
||||
this._displayLine = true;
|
||||
} else {
|
||||
// Up key
|
||||
if (this.getKeyboardEvent(e).keyCode === 38) { return; }
|
||||
e.preventDefault();
|
||||
this.$.fileCursor.previous();
|
||||
this.selectedIndex = this.$.fileCursor.index;
|
||||
}
|
||||
|
||||
@@ -368,6 +368,10 @@ limitations under the License.
|
||||
// j with a modifier should not move the cursor.
|
||||
MockInteractions.pressAndReleaseKeyOn(element, 74, 'shift', 'j');
|
||||
assert.equal(element.$.fileCursor.index, 0);
|
||||
// down should not move the cursor.
|
||||
MockInteractions.pressAndReleaseKeyOn(element, 40, null, 'down');
|
||||
assert.equal(element.$.fileCursor.index, 0);
|
||||
|
||||
MockInteractions.pressAndReleaseKeyOn(element, 74, null, 'j');
|
||||
assert.equal(element.$.fileCursor.index, 1);
|
||||
assert.equal(element.selectedIndex, 1);
|
||||
@@ -381,6 +385,10 @@ limitations under the License.
|
||||
MockInteractions.pressAndReleaseKeyOn(element, 75, 'shift', 'k');
|
||||
assert.equal(element.$.fileCursor.index, 2);
|
||||
|
||||
// up should not move the cursor.
|
||||
MockInteractions.pressAndReleaseKeyOn(element, 38, null, 'down');
|
||||
assert.equal(element.$.fileCursor.index, 2);
|
||||
|
||||
MockInteractions.pressAndReleaseKeyOn(element, 75, null, 'k');
|
||||
assert.equal(element.$.fileCursor.index, 1);
|
||||
assert.equal(element.selectedIndex, 1);
|
||||
|
||||
Reference in New Issue
Block a user