diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-23 18:11:27 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-23 18:11:27 +0300 |
commit | 003d7f2a09668af85f94e48ed49d60862b96d8f8 (patch) | |
tree | 10f9baf4674416a5a7ca376bcc651973a56917b5 /app/assets/javascripts/header_search | |
parent | e10ea43772b9a6be150a074be7e26bfd6fa0380e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/header_search')
-rw-r--r-- | app/assets/javascripts/header_search/components/app.vue | 17 | ||||
-rw-r--r-- | app/assets/javascripts/header_search/constants.js | 2 |
2 files changed, 13 insertions, 6 deletions
diff --git a/app/assets/javascripts/header_search/components/app.vue b/app/assets/javascripts/header_search/components/app.vue index 7dc1740b729..306183ebcca 100644 --- a/app/assets/javascripts/header_search/components/app.vue +++ b/app/assets/javascripts/header_search/components/app.vue @@ -35,6 +35,7 @@ import { IS_SEARCHING, IS_FOCUSED, IS_NOT_FOCUSED, + DROPDOWN_CLOSE_TIMEOUT, } from '../constants'; import HeaderSearchAutocompleteItems from './header_search_autocomplete_items.vue'; import HeaderSearchDefaultItems from './header_search_default_items.vue'; @@ -166,13 +167,17 @@ export default { }); }, collapseAndCloseSearchBar() { - this.isFocused = false; - this.$emit('collapseSearchBar'); + // without timeout dropdown closes + // before click event is dispatched + setTimeout(() => { + this.isFocused = false; + this.$emit('collapseSearchBar'); - Tracking.event(undefined, 'blur_input', { - label: 'global_search', - property: 'navigation_top', - }); + Tracking.event(undefined, 'blur_input', { + label: 'global_search', + property: 'navigation_top', + }); + }, DROPDOWN_CLOSE_TIMEOUT); }, submitSearch() { if (this.search?.length <= SEARCH_SHORTCUTS_MIN_CHARACTERS && this.currentFocusIndex < 0) { diff --git a/app/assets/javascripts/header_search/constants.js b/app/assets/javascripts/header_search/constants.js index b9bb4e573fd..47aeb2f9caa 100644 --- a/app/assets/javascripts/header_search/constants.js +++ b/app/assets/javascripts/header_search/constants.js @@ -31,3 +31,5 @@ export const IS_NOT_FOCUSED = 'is-not-focused'; export const FETCH_TYPES = ['generic', 'search']; export const SEARCH_INPUT_FIELD_MAX_WIDTH = '640px'; + +export const DROPDOWN_CLOSE_TIMEOUT = 200; |