diff options
author | Alfredo Sumaran <alfredo@gitlab.com> | 2016-04-05 19:19:00 -0500 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2016-04-05 19:19:00 -0500 |
commit | 8da5ac2748a62ad7ff21e7d47aae9514c85c0150 (patch) | |
tree | dca33155fe4eccc68159d2722d7c9094ff3a0f94 | |
parent | 7baebd322008e0ca912c447792f1d7cffd74f8e2 (diff) | |
download | gitlab-ce-issue_14800.tar.gz |
Change approach, do not use timeoutsissue_14800
-rw-r--r-- | app/assets/javascripts/search_autocomplete.js.coffee | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/app/assets/javascripts/search_autocomplete.js.coffee b/app/assets/javascripts/search_autocomplete.js.coffee index 564fb265b9d..10325c3fa8f 100644 --- a/app/assets/javascripts/search_autocomplete.js.coffee +++ b/app/assets/javascripts/search_autocomplete.js.coffee @@ -202,18 +202,11 @@ class @SearchAutocomplete @skipBlurEvent = true onSearchInputBlur: (e) => - @skipBlurEvent = false + @wrap.removeClass('search-active') - # We should wait to make sure we are not clearing the input instead - setTimeout( => - return if @skipBlurEvent - - @wrap.removeClass('search-active') - - # If input is blank then restore state - if @searchInput.val() is '' - @restoreOriginalState() - , 150) + # If input is blank then restore state + if @searchInput.val() is '' + @restoreOriginalState() addLocationBadge: (item) -> category = if item.category? then "#{item.category}: " else '' @@ -291,9 +284,5 @@ class @SearchAutocomplete $el.removeClass('is-active') @disableAutocomplete() + @onSearchInputFocus() @searchInput.val('').focus() - - # We need to wait because of @skipBlurEvent - setTimeout( => - @onSearchInputFocus() - , 200) |