Index: chrome/browser/resources/file_manager/js/file_manager.js |
diff --git a/chrome/browser/resources/file_manager/js/file_manager.js b/chrome/browser/resources/file_manager/js/file_manager.js |
index 8ae8d9d4e2a7536dcab3d66df1b1054e5d896c92..4795e94bc050e342d2e5f1f0bc5581fa76a7cf97 100644 |
--- a/chrome/browser/resources/file_manager/js/file_manager.js |
+++ b/chrome/browser/resources/file_manager/js/file_manager.js |
@@ -1049,6 +1049,8 @@ DialogType.isModal = function(type) { |
this.searchBox_ = this.dialogDom_.querySelector('#search-box'); |
this.searchBox_.addEventListener( |
'input', this.onSearchBoxUpdate_.bind(this)); |
+ this.searchBox_.addEventListener( |
+ 'keydown', this.onSearchBoxKeyDown_.bind(this)); |
this.searchTextMeasure_ = new TextMeasure(this.searchBox_); |
if (util.platform.newUI()) { |
this.searchIcon_ = this.dialogDom_.querySelector('#search-icon'); |
@@ -3523,6 +3525,28 @@ DialogType.isModal = function(type) { |
}; |
/** |
+ * Handled to special key such as ESC. |
mtomasz
2013/05/28 04:07:06
We usually start with a passive verb.
Eg. Handles
hirono
2013/05/28 04:24:26
Done.
|
+ * Normal text inputs should not be handled by this, should be handled by |
mtomasz
2013/05/28 04:07:06
I think that the second line is confusing. The fir
hirono
2013/05/28 04:24:26
Done.
|
+ * onSearchBoxUpdate_. |
+ * |
+ * @param {Event} event The 'keydown' event. |
mtomasz
2013/05/28 04:07:06
Without '' for consistency.
hirono
2013/05/28 04:24:26
Done.
|
+ * @private |
+ */ |
+ FileManager.prototype.onSearchBoxKeyDown_ = function(event) { |
+ // Handle only Esc key now. |
+ if (event.keyCode != 27) return; |
+ if (this.searchBox_.value) return; |
+ if (this.listType_ == FileManager.ListType.DETAIL) { |
+ this.table_.list.focus(); |
+ } else if (this.listType_ == FileManager.ListType.THUMBNAIL) { |
+ this.grid_.focus(); |
+ // The grid not selects its item when focused. |
mtomasz
2013/05/28 04:07:06
not selects -> does not select
hirono
2013/05/28 04:24:26
Done.
|
+ if (this.grid_.dataModel.length != 0) |
mtomasz
2013/05/28 04:07:06
Shall we do it for the table list too?
hirono
2013/05/28 04:24:26
Done.
|
+ this.grid_.selectionModel.selectedIndex = 0; |
+ } |
+ }; |
+ |
+ /** |
* Updates search box's CSS classes. |
* These classes are refered from CSS. |
* |