@@ -67,7 +67,7 @@ function initHotKeys() {
6767 var bodyEl = document.body;
6868 var searchInput = document.getElementById('search');
6969
70− document.addEventListener('keyup', function (event) {
70+ document.addEventListener('keydown', function (event) {
7171 if (event.defaultPrevented) {
7272 return;
7373 }
@@ -77,6 +77,16 @@ function initHotKeys() {
7777 // ESC to close search window
7878 if (key === 'Escape' || key === 'Esc' || key === 27) {
7979 document.body.classList.remove('has-active-search-window');
80+ console.log('esc');
81+ }
82+
83+ // / to close toggle window
84+ if (key === '/' || key === 'Period' || key === 58) {
85+ event.preventDefault();
86+ document.body.classList.toggle('has-active-search-window');
87+ if (bodyEl.classList.contains('has-active-search-window')) {
88+ searchInput.focus();
89+ }
8090 }
8191
8292 //when search is active TAB puts search input into focus
@@ -88,8 +98,6 @@ function initHotKeys() {
8898 });
8999};
90100
91−
92−
93101//
94102 // search functionality
95103//
@@ -303,7 +311,7 @@ function initSearch() {
303311 searchResultsHeader.value = "";
304312
305313 var term = searchInput.value.trim();
306−
314+
307315 /*
308316 //removed to fix: a state where there’s a valid search term, but no results
309317