| OLD | NEW |
| 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 DeletableItem = options.DeletableItem; | 6 /** @const */ var DeletableItem = options.DeletableItem; |
| 7 /** @const */ var DeletableItemList = options.DeletableItemList; | 7 /** @const */ var DeletableItemList = options.DeletableItemList; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Creates a new list item with support for inline editing. | 10 * Creates a new list item with support for inline editing. |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 * @type {boolean} | 421 * @type {boolean} |
| 422 */ | 422 */ |
| 423 focusPlaceholder: false, | 423 focusPlaceholder: false, |
| 424 | 424 |
| 425 /** @override */ | 425 /** @override */ |
| 426 decorate: function() { | 426 decorate: function() { |
| 427 DeletableItemList.prototype.decorate.call(this); | 427 DeletableItemList.prototype.decorate.call(this); |
| 428 this.setAttribute('inlineeditable', ''); | 428 this.setAttribute('inlineeditable', ''); |
| 429 this.addEventListener('hasElementFocusChange', | 429 this.addEventListener('hasElementFocusChange', |
| 430 this.handleListFocusChange_); | 430 this.handleListFocusChange_); |
| 431 this.removeAttribute('tabindex'); | 431 // <list> isn't focusable by default, but cr.ui.List defaults tabindex to |
| 432 // 0 if it's not set. |
| 433 this.tabIndex = -1; |
| 432 }, | 434 }, |
| 433 | 435 |
| 434 /** | 436 /** |
| 435 * Called when the list hierarchy as a whole loses or gains focus; starts | 437 * Called when the list hierarchy as a whole loses or gains focus; starts |
| 436 * or ends editing for the lead item if necessary. | 438 * or ends editing for the lead item if necessary. |
| 437 * @param {Event} e The change event. | 439 * @param {Event} e The change event. |
| 438 * @private | 440 * @private |
| 439 */ | 441 */ |
| 440 handleListFocusChange_: function(e) { | 442 handleListFocusChange_: function(e) { |
| 441 var leadItem = this.getListItemByIndex(this.selectionModel.leadIndex); | 443 var leadItem = this.getListItemByIndex(this.selectionModel.leadIndex); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 456 return true; | 458 return true; |
| 457 }, | 459 }, |
| 458 }; | 460 }; |
| 459 | 461 |
| 460 // Export | 462 // Export |
| 461 return { | 463 return { |
| 462 InlineEditableItem: InlineEditableItem, | 464 InlineEditableItem: InlineEditableItem, |
| 463 InlineEditableItemList: InlineEditableItemList, | 465 InlineEditableItemList: InlineEditableItemList, |
| 464 }; | 466 }; |
| 465 }); | 467 }); |
| OLD | NEW |