summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryosin@chromium.org <yosin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-16 02:21:21 +0000
committeryosin@chromium.org <yosin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-16 02:21:21 +0000
commit4e3cd617d2c06679c407345750858d4b5c86dacc (patch)
treeb50b0e9bf093caefeee4fb908290219e793c3645
parent45c4b1e2c78c68394f723bf7865481e232ffc806 (diff)
downloadchromium_src-4e3cd617d2c06679c407345750858d4b5c86dacc.zip
chromium_src-4e3cd617d2c06679c407345750858d4b5c86dacc.tar.gz
chromium_src-4e3cd617d2c06679c407345750858d4b5c86dacc.tar.bz2
Set selection on next item when selected items are removed.
BUG=81802 TEST=On Bookmark Manager, delete an item in a folder which contains more than one item. Review URL: https://codereview.chromium.org/11820047 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177057 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/resources/shared/js/cr/ui/list_selection_model.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/chrome/browser/resources/shared/js/cr/ui/list_selection_model.js b/chrome/browser/resources/shared/js/cr/ui/list_selection_model.js
index 98cd45f..a32304a 100644
--- a/chrome/browser/resources/shared/js/cr/ui/list_selection_model.js
+++ b/chrome/browser/resources/shared/js/cr/ui/list_selection_model.js
@@ -309,6 +309,7 @@ cr.define('cr.ui', function() {
this.beginChange();
var oldLeadIndex = this.leadIndex;
var oldAnchorIndex = this.anchorIndex;
+ var oldSelectedItemsCount = this.selectedIndexes.length;
this.selectedIndexes = this.selectedIndexes.map(function(oldIndex) {
return permutation[oldIndex];
@@ -321,6 +322,13 @@ cr.define('cr.ui', function() {
this.leadIndex = permutation[oldLeadIndex];
if (oldAnchorIndex != -1)
this.anchorIndex = permutation[oldAnchorIndex];
+
+ if (oldSelectedItemsCount && !this.selectedIndexes.length) {
+ // All selected items are deleted. We move selection to next item of
+ // last selected item.
+ this.selectedIndexes = [oldLeadIndex];
+ }
+
this.endChange();
},