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

Unified Diff: chrome/browser/resources/options/deletable_item_list.js

Issue 7903001: Improve Tab-key navigation for editing Autofill addresses and credit cards. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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
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.

Powered by Google App Engine
This is Rietveld 408576698