import {htmlToDom} from "../services/dom";
import {debounce} from "../services/util";
+import {KeyboardNavigationHandler} from "../services/keyboard-navigation";
+import {Component} from "./component";
/**
- * @extends {Component}
+ * Global (header) search box handling.
+ * Mainly to show live results preview.
*/
-class GlobalSearch {
+export class GlobalSearch extends Component {
setup() {
this.container = this.$el;
this.input.setAttribute('autocomplete', 'on');
this.button.focus();
this.input.focus();
- })
+ });
+
+ new KeyboardNavigationHandler(this.container, () => {
+ this.hideSuggestions();
+ });
}
/**
this.suggestions.classList.remove('search-suggestions-animation');
this.suggestionResultsWrap.innerHTML = '';
}
-}
-
-export default GlobalSearch;
\ No newline at end of file
+}
\ No newline at end of file