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

Unified Diff: chrome/browser/resources/md_history/history.js

Issue 2237703004: [MD History] Focus the search bar on load. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix drawer test Created 4 years, 4 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/md_history/history.js
diff --git a/chrome/browser/resources/md_history/history.js b/chrome/browser/resources/md_history/history.js
index 4cce580cc9e8ccc0e21f3930cb76b28bed560a43..b66887af29513d0d4dadfa1d8c5db0a943381e19 100644
--- a/chrome/browser/resources/md_history/history.js
+++ b/chrome/browser/resources/md_history/history.js
@@ -38,8 +38,8 @@ function waitForAppUpgrade() {
*/
function historyResult(info, results) {
waitForAppUpgrade().then(function() {
- /** @type {HistoryAppElement} */($('history-app'))
- .historyResult(info, results);
+ var app = /** @type {HistoryAppElement} */($('history-app'));
+ app.historyResult(info, results);
document.body.classList.remove('loading');
if (!resultsRendered) {
@@ -51,6 +51,12 @@ function historyResult(info, results) {
'metricsHandler:recordTime',
['History.ResultsRenderedTime', window.performance.now()]);
});
+
+ // Focus the search field on load. Done here to ensure the history page
+ // is rendered before we try to take focus.
+ if (!app.hasDrawer) {
+ app.focusToolbarSearchField();
+ }
}
});
}

Powered by Google App Engine
This is Rietveld 408576698