Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: chrome/browser/resources/md_bookmarks/list.js

Issue 2924673003: [MD Bookmarks] Make shift-selection behave well with no anchor. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/test/data/webui/md_bookmarks/md_bookmarks_focus_test.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/md_bookmarks/list.js
diff --git a/chrome/browser/resources/md_bookmarks/list.js b/chrome/browser/resources/md_bookmarks/list.js
index f960e2eb5243cc862611af4093176d11d3436e3d..7ecac29cf3e2de20a4fd2f5f602cee24c6aeb38f 100644
--- a/chrome/browser/resources/md_bookmarks/list.js
+++ b/chrome/browser/resources/md_bookmarks/list.js
@@ -130,6 +130,7 @@ Polymer({
var focusMoved = false;
var focusedIndex =
this.getIndexForItemElement_(/** @type {HTMLElement} */ (e.target));
+ var oldFocusedIndex = focusedIndex;
if (e.key == 'ArrowUp') {
focusedIndex--;
focusMoved = true;
@@ -166,6 +167,12 @@ Polymer({
this.dispatch(
bookmarks.actions.updateAnchor(this.displayedIds_[focusedIndex]));
} else {
+ // If shift-selecting with no anchor, use the old focus index.
+ if (e.shiftKey && this.getState().selection.anchor == null) {
+ this.dispatch(bookmarks.actions.updateAnchor(
+ this.displayedIds_[oldFocusedIndex]));
+ }
+
// If the focus moved from something other than a Ctrl + move event,
// update the selection.
var config = {
« no previous file with comments | « no previous file | chrome/test/data/webui/md_bookmarks/md_bookmarks_focus_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698