Chromium Code Reviews| Index: chrome/browser/resources/options/deletable_item_list.js |
| diff --git a/chrome/browser/resources/options/deletable_item_list.js b/chrome/browser/resources/options/deletable_item_list.js |
| index 3cff2aa6f58012564a18a3dbda9efec5b2954b72..81368acf609c9da7ba9f5ec7b22ce5249efa5f4d 100644 |
| --- a/chrome/browser/resources/options/deletable_item_list.js |
| +++ b/chrome/browser/resources/options/deletable_item_list.js |
| @@ -52,6 +52,8 @@ cr.define('options', function() { |
| this.handleMouseDownUpOnClose_); |
| this.closeButtonElement_.addEventListener('mouseup', |
| this.handleMouseDownUpOnClose_); |
| + this.closeButtonElement_.addEventListener('focus', |
| + this.handleFocus_.bind(this)); |
| this.appendChild(this.closeButtonElement_); |
| }, |
| @@ -75,6 +77,18 @@ cr.define('options', function() { |
| }, |
| /** |
| + * Called when the input element receives focus. Selects this item in the |
|
James Hawkins
2011/09/15 19:28:02
s/input element/close button element/
Ilya Sherman
2011/09/15 20:39:01
Generalized slightly to "focusable child element",
|
| + * list selection model. |
| + * @private |
| + */ |
| + handleFocus_: function() { |
| + var list = this.parentNode; |
| + var index = list.getIndexOfListItem(this); |
| + list.selectionModel.selectedIndex = index; |
| + list.selectionModel.anchorIndex = index; |
| + }, |
| + |
| + /** |
| * Don't let the list have a crack at the event. We don't want clicking the |
| * close button to change the selection of the list. |
| * @param {Event} e The mouse down/up event object. |