Focus search input when opened.

This commit is contained in:
Oliver Hamlet
2015-05-27 07:31:34 +01:00
parent d47d9f6bdc
commit 933bfda1b6
2 changed files with 5 additions and 0 deletions
+4
View File
@@ -109,6 +109,10 @@ searchTarget is the ID of the core-list element to search the elements of.
document.getElementById(host.searchTarget).scrollToItem(host.results[host.currentResult]);
},
focusInput: function() {
this.shadowRoot.getElementById('search').focus();
},
search: function() {
this.shadowRoot.getElementById('search').dispatchEvent(new Event('input'));
},
+1
View File
@@ -648,6 +648,7 @@ function onContentRefresh(evt) {
}
function onSearchOpen(evt) {
document.getElementById('mainToolbar').classList.add('search');
document.getElementById('searchBar').focusInput();
}
function onSearchClose(evt) {
document.getElementById('mainToolbar').classList.remove('search');