Index: ui/file_manager/file_manager/foreground/js/ui/file_manager_ui.js |
diff --git a/ui/file_manager/file_manager/foreground/js/ui/file_manager_ui.js b/ui/file_manager/file_manager/foreground/js/ui/file_manager_ui.js |
index f19d985568ab8c2753a6ec0fb0010b4522b1e79d..232e62cac61b3fa86b1bc498eebf4ee2d89cd62e 100644 |
--- a/ui/file_manager/file_manager/foreground/js/ui/file_manager_ui.js |
+++ b/ui/file_manager/file_manager/foreground/js/ui/file_manager_ui.js |
@@ -314,23 +314,24 @@ FileManagerUI.prototype.initAdditionalUI = function( |
// Add handlers. |
document.defaultView.addEventListener('resize', this.relayout.bind(this)); |
+}; |
+/** |
+ * Initializes the focus. |
+ */ |
+FileManagerUI.prototype.initUIFocus = function() { |
// Set the initial focus. When there is no focus, the active element is the |
// <body>. |
- setTimeout(function() { |
- if (document.activeElement === document.body) { |
- var targetElement = null; |
- if (this.dialogType_ == DialogType.SELECT_SAVEAS_FILE) { |
- targetElement = this.dialogFooter.filenameInput; |
- } else if (this.listContainer.currentListType != |
- ListContainer.ListType.UNINITIALIZED) { |
- targetElement = this.listContainer.currentList; |
- } |
- |
- if (targetElement) |
- targetElement.focus(); |
- } |
- }.bind(this), 0); |
+ var targetElement = null; |
+ if (this.dialogType_ == DialogType.SELECT_SAVEAS_FILE) { |
+ targetElement = this.dialogFooter.filenameInput; |
+ } else if (this.listContainer.currentListType != |
+ ListContainer.ListType.UNINITIALIZED) { |
+ targetElement = this.listContainer.currentList; |
+ } |
+ |
+ if (targetElement) |
+ targetElement.focus(); |
}; |
/** |