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

Side by Side Diff: chrome/browser/resources/options/deletable_item_list.js

Issue 429073006: Take care not to destroy a multi-selection when a child element of a list item receives focus. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('options', function() { 5 cr.define('options', function() {
6 /** @const */ var List = cr.ui.List; 6 /** @const */ var List = cr.ui.List;
7 /** @const */ var ListItem = cr.ui.ListItem; 7 /** @const */ var ListItem = cr.ui.ListItem;
8 8
9 /** 9 /**
10 * Creates a deletable list item, which has a button that will trigger a call 10 * Creates a deletable list item, which has a button that will trigger a call
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 set deletable(value) { 84 set deletable(value) {
85 this.deletable_ = value; 85 this.deletable_ = value;
86 this.closeButtonElement_.disabled = !value; 86 this.closeButtonElement_.disabled = !value;
87 }, 87 },
88 88
89 /** 89 /**
90 * Called when a focusable child element receives focus. Selects this item 90 * Called when a focusable child element receives focus. Selects this item
91 * in the list selection model. 91 * in the list selection model.
92 * @private 92 * @private
93 */ 93 */
94 handleFocus_: function() { 94 handleFocus_: function() {
Dan Beam 2014/07/30 19:05:34 if (this.selected) return;
engedy 2014/07/31 09:35:48 Done.
95 var list = this.parentNode; 95 var list = this.parentNode;
96 var index = list.getIndexOfListItem(this); 96 var index = list.getIndexOfListItem(this);
97 list.selectionModel.selectedIndex = index; 97
98 list.selectionModel.anchorIndex = index; 98 // This handler is also fired when the child receives focus as a result of
99 // the item getting selected by the customized mouse/keyboard handling in
100 // SelectionController. Take care not to destroy a potential multiple
101 // selection in this case.
102 if (!this.selected) {
103 list.selectionModel.selectedIndex = index;
104 list.selectionModel.anchorIndex = index;
105 }
99 }, 106 },
100 107
101 /** 108 /**
102 * Don't let the list have a crack at the event. We don't want clicking the 109 * Don't let the list have a crack at the event. We don't want clicking the
103 * close button to change the selection of the list or to focus on the close 110 * close button to change the selection of the list or to focus on the close
104 * button. 111 * button.
105 * @param {Event} e The mouse down/up event object. 112 * @param {Event} e The mouse down/up event object.
106 * @private 113 * @private
107 */ 114 */
108 handleMouseDownUpOnClose_: function(e) { 115 handleMouseDownUpOnClose_: function(e) {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 */ 196 */
190 deleteItemAtIndex: function(index) { 197 deleteItemAtIndex: function(index) {
191 }, 198 },
192 }; 199 };
193 200
194 return { 201 return {
195 DeletableItemList: DeletableItemList, 202 DeletableItemList: DeletableItemList,
196 DeletableItem: DeletableItem, 203 DeletableItem: DeletableItem,
197 }; 204 };
198 }); 205 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698