From 933bfda1b60002db4ef4410598b79b9a744c3d80 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Wed, 27 May 2015 07:31:34 +0100 Subject: [PATCH] Focus search input when opened. --- resources/report/html/loot-search.html | 4 ++++ resources/report/js/events.js | 1 + 2 files changed, 5 insertions(+) diff --git a/resources/report/html/loot-search.html b/resources/report/html/loot-search.html index c8b2ca07..5420bf56 100644 --- a/resources/report/html/loot-search.html +++ b/resources/report/html/loot-search.html @@ -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')); }, diff --git a/resources/report/js/events.js b/resources/report/js/events.js index f42719d7..6b2d41d2 100644 --- a/resources/report/js/events.js +++ b/resources/report/js/events.js @@ -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');